Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
A
atlas
Project
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
dataplatform
atlas
Commits
ed07049a
Commit
ed07049a
authored
Jul 07, 2016
by
Shwetha GS
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
ATLAS-968 Set group information from UGI for Ldap authentication (nixonrodrigues via shwethags)
parent
dda382f4
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
48 additions
and
0 deletions
+48
-0
atlas-application.properties
distro/src/conf/atlas-application.properties
+2
-0
release-log.txt
release-log.txt
+1
-0
AtlasADAuthenticationProvider.java
...che/atlas/web/security/AtlasADAuthenticationProvider.java
+5
-0
AtlasAbstractAuthenticationProvider.java
...las/web/security/AtlasAbstractAuthenticationProvider.java
+35
-0
AtlasLdapAuthenticationProvider.java
...e/atlas/web/security/AtlasLdapAuthenticationProvider.java
+5
-0
No files found.
distro/src/conf/atlas-application.properties
View file @
ed07049a
...
...
@@ -101,6 +101,8 @@ atlas.authentication.method.ldap.type=LDAP
#### user credentials file
atlas.authentication.method.file.filename
=
${sys:atlas.home}/conf/users-credentials.properties
### groups from UGI
#atlas.authentication.method.ldap.ugi-groups=true
######## LDAP properties #########
#atlas.authentication.method.ldap.url=ldap://<ldap server url>:389
...
...
release-log.txt
View file @
ed07049a
...
...
@@ -6,6 +6,7 @@ INCOMPATIBLE CHANGES:
ALL CHANGES:
ATLAS-968 Set group information from UGI for Ldap authentication (nixonrodrigues via shwethags)
ATLAS-584 Integrate CSRF prevention filter (kevalbhatt18 via shwethags)
ATLAS-963 UI: Entity details is not display String array attribute values correctly (kevalbhatt18 via shwethags)
ATLAS-988 HiveHookIT.testInsertIntoTable is broken (svimal2106 via shwethags)
...
...
webapp/src/main/java/org/apache/atlas/web/security/AtlasADAuthenticationProvider.java
View file @
ed07049a
...
...
@@ -48,6 +48,7 @@ public class AtlasADAuthenticationProvider extends
private
String
adBase
;
private
String
adReferral
;
private
String
adDefaultRole
;
private
boolean
groupsFromUGI
;
@PostConstruct
public
void
setup
()
{
...
...
@@ -85,6 +86,9 @@ public class AtlasADAuthenticationProvider extends
final
Authentication
finalAuthentication
=
new
UsernamePasswordAuthenticationToken
(
principal
,
userPassword
,
grantedAuths
);
authentication
=
adAuthenticationProvider
.
authenticate
(
finalAuthentication
);
if
(
groupsFromUGI
)
{
authentication
=
getAuthenticationWithGrantedAuthorityFromUGI
(
authentication
);
}
return
authentication
;
}
else
{
throw
new
AtlasAuthenticationException
(
...
...
@@ -109,6 +113,7 @@ public class AtlasADAuthenticationProvider extends
this
.
adBase
=
configuration
.
getString
(
"atlas.authentication.method.ldap.ad.base.dn"
);
this
.
adReferral
=
configuration
.
getString
(
"atlas.authentication.method.ldap.ad.referral"
);
this
.
adDefaultRole
=
configuration
.
getString
(
"atlas.authentication.method.ldap.ad.default.role"
);
this
.
groupsFromUGI
=
configuration
.
getBoolean
(
"atlas.authentication.method.ldap.ugi-groups"
,
true
);
}
catch
(
Exception
e
)
{
LOG
.
error
(
"Exception while setADProperties"
,
e
);
...
...
webapp/src/main/java/org/apache/atlas/web/security/AtlasAbstractAuthenticationProvider.java
View file @
ed07049a
...
...
@@ -22,6 +22,7 @@ package org.apache.atlas.web.security;
import
java.util.ArrayList
;
import
java.util.List
;
import
org.apache.hadoop.security.UserGroupInformation
;
import
org.springframework.security.authentication.AuthenticationProvider
;
import
org.springframework.security.authentication.UsernamePasswordAuthenticationToken
;
import
org.springframework.security.core.Authentication
;
...
...
@@ -71,4 +72,38 @@ public abstract class AtlasAbstractAuthenticationProvider implements
return
grantedAuths
;
}
public
Authentication
getAuthenticationWithGrantedAuthorityFromUGI
(
Authentication
authentication
)
{
UsernamePasswordAuthenticationToken
result
=
null
;
if
(
authentication
!=
null
&&
authentication
.
isAuthenticated
())
{
List
<
GrantedAuthority
>
grantedAuthsUGI
=
getAuthoritiesFromUGI
(
authentication
.
getName
().
toString
());
final
UserDetails
userDetails
=
new
User
(
authentication
.
getName
()
.
toString
(),
authentication
.
getCredentials
().
toString
(),
grantedAuthsUGI
);
result
=
new
UsernamePasswordAuthenticationToken
(
userDetails
,
authentication
.
getCredentials
(),
grantedAuthsUGI
);
result
.
setDetails
(
authentication
.
getDetails
());
return
result
;
}
return
authentication
;
}
public
List
<
GrantedAuthority
>
getAuthoritiesFromUGI
(
String
userName
)
{
List
<
GrantedAuthority
>
grantedAuths
=
new
ArrayList
<
GrantedAuthority
>();
UserGroupInformation
ugi
=
UserGroupInformation
.
createRemoteUser
(
userName
);
if
(
ugi
!=
null
)
{
String
[]
userGroups
=
ugi
.
getGroupNames
();
if
(
userGroups
!=
null
)
{
for
(
String
group
:
userGroups
)
{
grantedAuths
.
add
(
new
SimpleGrantedAuthority
(
group
));
}
}
}
return
grantedAuths
;
}
}
webapp/src/main/java/org/apache/atlas/web/security/AtlasLdapAuthenticationProvider.java
View file @
ed07049a
...
...
@@ -54,6 +54,7 @@ public class AtlasLdapAuthenticationProvider extends
private
String
ldapUserSearchFilter
;
private
String
ldapReferral
;
private
String
ldapBase
;
private
boolean
groupsFromUGI
;
@PostConstruct
public
void
setup
()
{
...
...
@@ -107,6 +108,9 @@ public class AtlasLdapAuthenticationProvider extends
final
Authentication
finalAuthentication
=
new
UsernamePasswordAuthenticationToken
(
principal
,
userPassword
,
grantedAuths
);
authentication
=
ldapAuthenticationProvider
.
authenticate
(
finalAuthentication
);
if
(
groupsFromUGI
)
{
authentication
=
getAuthenticationWithGrantedAuthorityFromUGI
(
authentication
);
}
return
authentication
;
}
else
{
throw
new
AtlasAuthenticationException
(
...
...
@@ -141,6 +145,7 @@ public class AtlasLdapAuthenticationProvider extends
"atlas.authentication.method.ldap.user.searchfilter"
);
ldapReferral
=
configuration
.
getString
(
"atlas.authentication.method.ldap.ad.referral"
);
ldapBase
=
configuration
.
getString
(
"atlas.authentication.method.ldap.base.dn"
);
groupsFromUGI
=
configuration
.
getBoolean
(
"atlas.authentication.method.ldap.ugi-groups"
,
true
);
}
catch
(
Exception
e
)
{
LOG
.
error
(
"Exception while setLdapProperties"
,
e
);
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment