Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 7 additions & 7 deletions distro/src/conf/atlas-application.properties
Original file line number Diff line number Diff line change
Expand Up @@ -167,6 +167,12 @@ atlas.authentication.method.file.filename=${sys:atlas.home}/conf/users-credentia
#atlas.authentication.method.ldap.ad.user.searchfilter=(sAMAccountName={0})
#atlas.authentication.method.ldap.ad.default.role=<default role>

######### Header Based Authentication #########
#atlas.authentication.method.header.enabled=false
#atlas.authentication.method.header.username=username
#atlas.authentication.method.header.roles=roles
#atlas.authentication.method.header.request-id=requestid

######### JAAS Configuration ########

#atlas.jaas.KafkaClient.loginModuleName = com.sun.security.auth.module.Krb5LoginModule
Expand Down Expand Up @@ -281,10 +287,4 @@ atlas.search.gremlin.enable=false

######### Skip check for the same attribute name in Parent type and Child type #########

#atlas.skip.check.for.parent.child.attribute.name=true

######### Header Based Authentication #########
#atlas.authn.header.enabled=false
#atlas.authn.header.username=x-awc-username
#atlas.authn.header.roles=x-awc-roles
#atlas.authn.header.requestid=x-awc-requestid
#atlas.skip.check.for.parent.child.attribute.name=true
Original file line number Diff line number Diff line change
Expand Up @@ -50,10 +50,10 @@
public class AtlasHeaderPreAuthFilter implements Filter {
private static final Logger LOG = LoggerFactory.getLogger(AtlasHeaderPreAuthFilter.class);

public static final String PROP_HEADER_AUTH_ENABLED = "atlas.authn.header.enabled";
public static final String PROP_USERNAME_HEADER = "atlas.authn.header.username";
public static final String PROP_ROLES_HEADER = "atlas.authn.header.roles";
public static final String PROP_REQUEST_ID_HEADER = "atlas.authn.header.requestid";
public static final String PROP_HEADER_AUTH_ENABLED = "atlas.authentication.method.header.enabled";
public static final String PROP_USERNAME_HEADER = "atlas.authentication.method.header.username";
public static final String PROP_ROLES_HEADER = "atlas.authentication.method.header.roles";
public static final String PROP_REQUEST_ID_HEADER = "atlas.authentication.method.header.request-id";
public static final String REQUEST_ID_ATTRIBUTE = "atlas.request.id";

private Configuration configuration;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -74,11 +74,11 @@ public void tearDown() {
public void testDoFilterEnabledWithUsernameAndRoles() throws Exception {
when(configuration.getBoolean(AtlasHeaderPreAuthFilter.PROP_HEADER_AUTH_ENABLED, false)).thenReturn(true);
when(configuration.getString(AtlasHeaderPreAuthFilter.PROP_USERNAME_HEADER, ""))
.thenReturn("x-user");
.thenReturn("X-Forwarded-User");
when(configuration.getString(AtlasHeaderPreAuthFilter.PROP_ROLES_HEADER, ""))
.thenReturn("x-roles");
when(request.getHeader("x-user")).thenReturn("alice");
when(request.getHeader("x-roles")).thenReturn("ROLE_ADMIN, ROLE_USER");
.thenReturn("X-Forwarded-Groups");
when(request.getHeader("X-Forwarded-User")).thenReturn("alice");
when(request.getHeader("X-Forwarded-Groups")).thenReturn("ROLE_ADMIN, ROLE_USER");

try (MockedStatic<ApplicationProperties> appProps = org.mockito.Mockito.mockStatic(ApplicationProperties.class)) {
appProps.when(ApplicationProperties::get).thenReturn(configuration);
Expand All @@ -104,10 +104,10 @@ public void testDoFilterEnabledWithUsernameAndRoles() throws Exception {
public void testDoFilterEnabledWithoutUsernameDoesNotAuthenticate() throws IOException, ServletException {
when(configuration.getBoolean(AtlasHeaderPreAuthFilter.PROP_HEADER_AUTH_ENABLED, false)).thenReturn(true);
when(configuration.getString(AtlasHeaderPreAuthFilter.PROP_USERNAME_HEADER, ""))
.thenReturn("x-user");
.thenReturn("X-Forwarded-User");
when(configuration.getString(AtlasHeaderPreAuthFilter.PROP_ROLES_HEADER, ""))
.thenReturn("x-roles");
when(request.getHeader("x-user")).thenReturn(" ");
.thenReturn("X-Forwarded-Groups");
when(request.getHeader("X-Forwarded-User")).thenReturn(" ");

try (MockedStatic<ApplicationProperties> appProps = org.mockito.Mockito.mockStatic(ApplicationProperties.class)) {
appProps.when(ApplicationProperties::get).thenReturn(configuration);
Expand All @@ -128,10 +128,8 @@ public void testDoFilterEnabledKeepsExistingAuthentication() throws IOException,

when(configuration.getBoolean(AtlasHeaderPreAuthFilter.PROP_HEADER_AUTH_ENABLED, false)).thenReturn(true);
when(configuration.getString(AtlasHeaderPreAuthFilter.PROP_USERNAME_HEADER, ""))
.thenReturn("x-user");
when(configuration.getString(AtlasHeaderPreAuthFilter.PROP_ROLES_HEADER, ""))
.thenReturn("x-roles");
when(request.getHeader("x-user")).thenReturn("alice");
.thenReturn("X-Forwarded-User");
when(request.getHeader("X-Forwarded-User")).thenReturn("alice");

try (MockedStatic<ApplicationProperties> appProps = org.mockito.Mockito.mockStatic(ApplicationProperties.class)) {
appProps.when(ApplicationProperties::get).thenReturn(configuration);
Expand Down