Skip to content

Commit

Permalink
KNOX-998 - Some more refactoring, making sure all the Unit Tests run …
Browse files Browse the repository at this point in the history
…and build passes !
  • Loading branch information
moresandeep committed Aug 31, 2017
1 parent 912c536 commit 2e6713b
Show file tree
Hide file tree
Showing 140 changed files with 325 additions and 374 deletions.
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ target
install
patch
candidate
org.apache.hadoop.gateway.security.EmbeddedApacheDirectoryServer/
org.apache.knox.gateway.security.EmbeddedApacheDirectoryServer/
velocity.log
*.pyc
*.py~
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@

<script type="text/javascript" src="js/knoxauth.js"></script>
<%
Topology topology = (Topology)request.getSession().getServletContext().getAttribute("org.apache.hadoop.gateway.topology");
Topology topology = (Topology)request.getSession().getServletContext().getAttribute("org.apache.knox.gateway.topology");
String whitelist = null;
Collection services = topology.getServices();
for (Object service : services) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,6 @@
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
main.class = org.apache.hadoop.gateway.security.ldap.SimpleLdapDirectoryServer
main.class = org.apache.knox.gateway.security.ldap.SimpleLdapDirectoryServer
class.path = ../lib/*.jar;../dep/*.jar;../ext;../ext/*.jar
log4j.configuration=${launcher.dir}/../conf/${launcher.name}-log4j.properties
4 changes: 2 additions & 2 deletions gateway-demo-ldap/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@
</execution>
</executions>
<configuration>
<mainClass>org.apache.hadoop.gateway.security.EmbeddedApacheDirectoryServer</mainClass>
<mainClass>org.apache.knox.gateway.security.EmbeddedApacheDirectoryServer</mainClass>
</configuration>
</plugin>
</plugins>
Expand All @@ -74,7 +74,7 @@
<transformer
implementation="org.apache.maven.plugins.shade.resource.ManifestResourceTransformer">
<manifestEntries>
<Main-Class>org.apache.hadoop.gateway.security.EmbeddedApacheDirectoryServer
<Main-Class>org.apache.knox.gateway.security.EmbeddedApacheDirectoryServer
</Main-Class>
</manifestEntries>
</transformer>
Expand Down
4 changes: 2 additions & 2 deletions gateway-demo-ldap/src/main/resources/log4j.properties
Original file line number Diff line number Diff line change
Expand Up @@ -21,5 +21,5 @@ log4j.appender.stdout.layout=org.apache.log4j.PatternLayout
log4j.appender.stdout.layout.ConversionPattern=%d{ISO8601} %-5p %m%n

#log4j.logger.org.apache.directory=INFO
#log4j.logger.org.apache.hadoop.gateway=INFO
#log4j.logger.org.apache.hadoop.gateway=DEBUG
#log4j.logger.org.apache.knox.gateway=INFO
#log4j.logger.org.apache.knox.gateway=DEBUG
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
import org.apache.knox.gateway.i18n.messages.Messages;
import org.apache.knox.gateway.i18n.messages.StackTrace;

@Messages(logger = "org.apache.hadoop.gateway")
@Messages(logger = "org.apache.knox.gateway")
public interface HaDispatchMessages {
@Message(level = MessageLevel.INFO, text = "Initializing Ha Dispatch for: {0}")
void initializingForResourceRole(String resourceRole);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
import org.apache.knox.gateway.i18n.messages.MessageLevel;
import org.apache.knox.gateway.i18n.messages.Messages;

@Messages(logger = "org.apache.hadoop.gateway")
@Messages(logger = "org.apache.knox.gateway")
public interface HaMessages {

@Message(level = MessageLevel.ERROR, text = "Failed to Write HA Descriptor: {0}")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
import org.apache.knox.gateway.i18n.messages.Messages;
import org.apache.knox.gateway.i18n.messages.StackTrace;

@Messages(logger="org.apache.hadoop.gateway")
@Messages(logger="org.apache.knox.gateway")
public interface IdentityAsserterMessages {

@Message( level = MessageLevel.WARN, text = "Skipping unencodable parameter {0}={1}, {2}: {3}" )
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
import org.apache.knox.gateway.i18n.messages.Messages;
import org.apache.knox.gateway.i18n.messages.StackTrace;

@Messages(logger="org.apache.hadoop.gateway")
@Messages(logger="org.apache.knox.gateway")
public interface ConcatIdentityAsserterMessages {

@Message( level = MessageLevel.WARN, text = "Skipping unencodable parameter {0}={1}, {2}: {3}" )
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ public String getName() {
/*
* (non-Javadoc)
*
* @see org.apache.hadoop.gateway.identityasserter.common.filter.
* @see org.apache.knox.gateway.identityasserter.common.filter.
* AbstractIdentityAsserterDeploymentContributor#getFilterClassname()
*/
@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
* @since 0.11
*/

@Messages(logger="org.apache.hadoop.gateway")
@Messages(logger="org.apache.knox.gateway")
public interface HadoopGroupProviderMessages {

@Message( level = MessageLevel.ERROR, text = "Error getting groups for principal {0}" )
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
import org.apache.knox.gateway.i18n.messages.Messages;
import org.apache.knox.gateway.i18n.messages.StackTrace;

@Messages(logger="org.apache.hadoop.gateway")
@Messages(logger="org.apache.knox.gateway")
public interface IdentityAsserterMessages {

@Message( level = MessageLevel.WARN, text = "Skipping unencodable parameter {0}={1}, {2}: {3}" )
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -74,10 +74,10 @@ public List<String> resolve( UrlRewriteContext context, List<String> parameters
result = new ArrayList<String>( parameters.size() );
for( String parameter : parameters ) {
switch( context.getDirection() ) {
case UrlRewriter.Direction.IN:
case IN:
parameter = hostMapper.resolveInboundHostName( parameter );
break;
case UrlRewriter.Direction.OUT:
case OUT:
parameter = hostMapper.resolveOutboundHostName( parameter );
break;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -66,10 +66,10 @@ public List<String> resolve( UrlRewriteContext context, List<String> parameters
String hostStr = host.getFirstValue().getPattern();
if( hostmap != null ) {
switch( context.getDirection() ) {
case UrlRewriter.Direction.IN:
case IN:
parameter = hostmap.resolveInboundHostName( hostStr );
break;
case UrlRewriter.Direction.OUT:
case OUT:
parameter = hostmap.resolveOutboundHostName( hostStr );
break;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
import org.apache.knox.gateway.i18n.messages.Messages;
import org.apache.knox.gateway.i18n.messages.StackTrace;

@Messages(logger="org.apache.hadoop.gateway.encrypturi")
@Messages(logger="org.apache.knox.gateway.encrypturi")
public interface EncryptUriMessages {

@Message( level = MessageLevel.ERROR, text = "Failed to create or verify the presence of a password for URL encryption: {0}" )
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
import org.apache.knox.gateway.i18n.messages.Messages;
import org.apache.knox.gateway.i18n.messages.StackTrace;

@Messages(logger="org.apache.hadoop.gateway.securequery")
@Messages(logger="org.apache.knox.gateway.securequery")
public interface SecureQueryMessages {

@Message( level = MessageLevel.ERROR, text = "Failed to create or verify the presence of a password for query string encryption: {0}" )
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
import org.apache.knox.gateway.i18n.messages.StackTrace;
import org.apache.knox.gateway.util.urltemplate.Template;

@Messages(logger="org.apache.hadoop.gateway")
@Messages(logger="org.apache.knox.gateway")
public interface UrlRewriteMessages {

@Message( level = MessageLevel.DEBUG, text = "Failed to parse value as URL: {0}" )
Expand Down
8 changes: 4 additions & 4 deletions gateway-provider-rewrite/src/test/resources/log4j.properties
Original file line number Diff line number Diff line change
Expand Up @@ -22,10 +22,10 @@ log4j.appender.stdout=org.apache.log4j.ConsoleAppender
log4j.appender.stdout.layout=org.apache.log4j.PatternLayout
log4j.appender.stdout.layout.ConversionPattern=%5p [%c] %m%n

#log4j.logger.org.apache.hadoop.gateway=DEBUG
#log4j.logger.org.apache.hadoop.gateway.http=TRACE
#log4j.logger.org.apache.hadoop.gateway.http.request.body=OFF
#log4j.logger.org.apache.hadoop.gateway.http.response.body=OFF
#log4j.logger.org.apache.knox.gateway=DEBUG
#log4j.logger.org.apache.knox.gateway.http=TRACE
#log4j.logger.org.apache.knox.gateway.http.request.body=OFF
#log4j.logger.org.apache.knox.gateway.http.response.body=OFF

#log4j.logger.org.apache.directory=DEBUG
#log4j.logger.org.eclipse.jetty=DEBUG
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ public class AnonymousAuthDeploymentContributor extends ProviderDeploymentContri
private static final String ROLE = "authentication";
private static final String NAME = "Anonymous";

private static final String FILTER_CLASSNAME = "AnonymousAuthFilter";
private static final String FILTER_CLASSNAME = "org.apache.knox.gateway.filter.AnonymousAuthFilter";

@Override
public String getRole() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@

public class AclsAuthzDeploymentContributor extends ProviderDeploymentContributorBase {

private static final String FILTER_CLASSNAME = "AclsAuthorizationFilter";
private static final String FILTER_CLASSNAME = "org.apache.knox.gateway.filter.AclsAuthorizationFilter";

@Override
public String getRole() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
import org.apache.knox.gateway.i18n.messages.MessageLevel;
import org.apache.knox.gateway.i18n.messages.Messages;

@Messages(logger="org.apache.hadoop.gateway")
@Messages(logger="org.apache.knox.gateway")
public interface AclsAuthorizationMessages {

@Message( level = MessageLevel.INFO, text = "Initializing AclsAuthz Provider for: {0}" )
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
import org.apache.knox.gateway.i18n.messages.MessageLevel;
import org.apache.knox.gateway.i18n.messages.Messages;

@Messages(logger="org.apache.hadoop.gateway.provider.global.hadoopauth")
@Messages(logger="org.apache.knox.gateway.provider.global.hadoopauth")
public interface HadoopAuthMessages {

@Message( level = MessageLevel.INFO, text = "Initializing Hadoop Auth Property, name: {0}, value: {1}" )
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
import org.apache.knox.gateway.i18n.messages.Messages;
import org.apache.knox.gateway.i18n.messages.StackTrace;

@Messages(logger="org.apache.hadoop.gateway.provider.federation.jwt")
@Messages(logger="org.apache.knox.gateway.provider.federation.jwt")
public interface JWTMessages {
@Message( level = MessageLevel.WARN, text = "Failed to validate the audience attribute." )
void failedToValidateAudience();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
*
* @since 0.8.0
*/
@Messages(logger="org.apache.hadoop.gateway.pac4j")
@Messages(logger="org.apache.knox.gateway.pac4j")
public interface Pac4jMessages {

@Message( level = MessageLevel.ERROR, text = "pac4j callback URL required")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,16 +17,15 @@
*/
package org.apache.knox.gateway.pac4j.filter;

import org.apache.hadoop.gateway.audit.api.*;
import org.apache.knox.gateway.audit.api.Action;
import org.apache.knox.gateway.audit.api.ActionOutcome;
import org.apache.knox.gateway.audit.api.AuditService;
import org.apache.knox.gateway.audit.api.AuditServiceFactory;
import org.apache.knox.gateway.audit.api.Auditor;
import org.apache.knox.gateway.audit.api.ResourceType;
import org.apache.knox.gateway.audit.log4j.audit.AuditConstants;
import org.apache.knox.gateway.filter.AbstractGatewayFilter;
import org.apache.knox.gateway.security.PrimaryPrincipal;
import org.apache.knox.gateway.audit.api.AuditService;
import org.apache.knox.gateway.audit.api.AuditServiceFactory;
import org.pac4j.core.config.ConfigSingleton;
import org.pac4j.core.context.J2EContext;
import org.pac4j.core.profile.ProfileManager;
Expand All @@ -35,7 +34,12 @@
import org.slf4j.LoggerFactory;

import javax.security.auth.Subject;
import javax.servlet.*;
import javax.servlet.Filter;
import javax.servlet.FilterChain;
import javax.servlet.FilterConfig;
import javax.servlet.ServletException;
import javax.servlet.ServletRequest;
import javax.servlet.ServletResponse;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
import org.apache.knox.gateway.i18n.messages.Messages;
import org.apache.knox.gateway.i18n.messages.StackTrace;

@Messages(logger="org.apache.hadoop.gateway.picketlink")
@Messages(logger="org.apache.knox.gateway.picketlink")
public interface PicketlinkMessages {

@Message( level = MessageLevel.DEBUG, text = "Found Original URL in reequest: {0}")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,6 @@

import org.apache.knox.gateway.i18n.messages.Messages;

@Messages(logger="org.apache.hadoop.gateway.provider.global.csrf")
@Messages(logger="org.apache.knox.gateway.provider.global.csrf")
public interface PreAuthMessages {
}
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ public class HeaderPreAuthContributor extends
ProviderDeploymentContributorBase {
private static final String ROLE = "federation";
private static final String NAME = "HeaderPreAuth";
private static final String PREAUTH_FILTER_CLASSNAME = "HeaderPreAuthFederationFilter";
private static final String PREAUTH_FILTER_CLASSNAME = "org.apache.knox.gateway.preauth.filter.HeaderPreAuthFederationFilter";

@Override
public String getRole() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
package org.apache.knox.gateway.provider.federation;

import junit.framework.TestCase;
import org.apache.hadoop.gateway.preauth.filter.*;
import org.apache.knox.gateway.preauth.filter.*;
import org.apache.knox.gateway.preauth.filter.DefaultValidator;
import org.apache.knox.gateway.preauth.filter.HeaderPreAuthFederationFilter;
import org.apache.knox.gateway.preauth.filter.IPValidator;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
package org.apache.knox.gateway.provider.federation;

import junit.framework.TestCase;
import org.apache.hadoop.gateway.preauth.filter.*;
import org.apache.knox.gateway.preauth.filter.*;
import org.apache.knox.gateway.preauth.filter.DefaultValidator;
import org.apache.knox.gateway.preauth.filter.IPValidator;
import org.apache.knox.gateway.preauth.filter.PreAuthService;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,9 +37,9 @@ public class ShiroDeploymentContributor extends ProviderDeploymentContributorBas

private static final String LISTENER_CLASSNAME = "org.apache.shiro.web.env.EnvironmentLoaderListener";
private static final String SHIRO_FILTER_CLASSNAME = "org.apache.shiro.web.servlet.ShiroFilter";
private static final String POST_FILTER_CLASSNAME = "ShiroSubjectIdentityAdapter";
private static final String COOKIE_FILTER_CLASSNAME = "ResponseCookieFilter";
private static final String REDIRECT_FILTER_CLASSNAME = "RedirectToUrlFilter";
private static final String POST_FILTER_CLASSNAME = "org.apache.knox.gateway.filter.ShiroSubjectIdentityAdapter";
private static final String COOKIE_FILTER_CLASSNAME = "org.apache.knox.gateway.filter.ResponseCookieFilter";
private static final String REDIRECT_FILTER_CLASSNAME = "org.apache.knox.gateway.filter.RedirectToUrlFilter";
private static final String SESSION_TIMEOUT = "sessionTimeout";
private static final String REMEMBER_ME = "rememberme";
private static final String SHRIO_CONFIG_FILE_NAME = "shiro.ini";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
import org.apache.shiro.authc.AuthenticationToken;
import org.apache.shiro.subject.Subject;

@Messages(logger = "org.apache.hadoop.gateway")
@Messages(logger = "org.apache.knox.gateway")
public interface KnoxShiroMessages {

@Message(level = MessageLevel.ERROR, text = "Shiro unable to login: {0}")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,6 @@

import org.apache.knox.gateway.i18n.messages.Messages;

@Messages(logger="org.apache.hadoop.gateway.provider.global.csrf")
@Messages(logger="org.apache.knox.gateway.provider.global.csrf")
public interface WebAppSecMessages {
}
Original file line number Diff line number Diff line change
Expand Up @@ -34,15 +34,16 @@ public class WebAppSecContributor extends
private static final String ROLE = "webappsec";
private static final String NAME = "WebAppSec";
private static final String CSRF_SUFFIX = "_CSRF";
private static final String CSRF_FILTER_CLASSNAME = "CSRFPreventionFilter";
private static final String CSRF_FILTER_CLASSNAME = "org.apache.knox.gateway.webappsec.filter.CSRFPreventionFilter";
private static final String CSRF_ENABLED = "csrf.enabled";
private static final String CORS_SUFFIX = "_CORS";
private static final String CORS_FILTER_CLASSNAME = "com.thetransactioncompany.cors.CORSFilter";
private static final String CORS_ENABLED = "cors.enabled";
private static final String XFRAME_OPTIONS_SUFFIX = "_XFRAMEOPTIONS";
private static final String XFRAME_OPTIONS_FILTER_CLASSNAME = "XFrameOptionsFilter";
private static final String XFRAME_OPTIONS_FILTER_CLASSNAME = "org.apache.knox.gateway.webappsec.filter.XFrameOptionsFilter";
private static final String XFRAME_OPTIONS_ENABLED = "xframe.options.enabled";


@Override
public String getRole() {
return ROLE;
Expand Down
20 changes: 10 additions & 10 deletions gateway-release/home/conf/gateway-log4j.properties
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,8 @@ app.audit.file=${launcher.name}-audit.log

log4j.rootLogger=ERROR, drfa

log4j.logger.org.apache.hadoop.gateway=INFO
#log4j.logger.org.apache.hadoop.gateway=DEBUG
log4j.logger.org.apache.knox.gateway=INFO
#log4j.logger.org.apache.knox.gateway=DEBUG

#log4j.logger.org.eclipse.jetty=DEBUG
#log4j.logger.org.apache.shiro=DEBUG
Expand All @@ -47,15 +47,15 @@ log4j.appender.auditfile.Append = true
log4j.appender.auditfile.DatePattern = '.'yyyy-MM-dd
log4j.appender.auditfile.layout = org.apache.knox.gateway.audit.log4j.layout.AuditLayout

#log4j.logger.org.apache.hadoop.gateway.access=TRACE,httpaccess
#log4j.additivity.org.apache.hadoop.gateway.access=false
#log4j.logger.org.apache.knox.gateway.access=TRACE,httpaccess
#log4j.additivity.org.apache.knox.gateway.access=false

#log4j.logger.org.apache.hadoop.gateway.http=TRACE,httpserver
#log4j.additivity.org.apache.hadoop.gateway.http=false
##log4j.logger.org.apache.hadoop.gateway.http.request.headers=OFF
##log4j.logger.org.apache.hadoop.gateway.http.response.headers=OFF
##log4j.logger.org.apache.hadoop.gateway.http.request.body=OFF
##log4j.logger.org.apache.hadoop.gateway.http.response.body=OFF
#log4j.logger.org.apache.knox.gateway.http=TRACE,httpserver
#log4j.additivity.org.apache.knox.gateway.http=false
##log4j.logger.org.apache.knox.gateway.http.request.headers=OFF
##log4j.logger.org.apache.knox.gateway.http.response.headers=OFF
##log4j.logger.org.apache.knox.gateway.http.request.body=OFF
##log4j.logger.org.apache.knox.gateway.http.response.body=OFF

#log4j.logger.org.apache.http.wire=DEBUG,httpclient
#log4j.additivity.org.apache.http.wire=false
Expand Down
Loading

0 comments on commit 2e6713b

Please sign in to comment.