Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
Menu
Open sidebar
Open Subsurface Data Universe Software
Platform
Security and Compliance
entitlements-azure
Commits
72142151
Commit
72142151
authored
Sep 17, 2020
by
Alok Joshi
Browse files
update oid
parent
5ac2e4e2
Changes
1
Hide whitespace changes
Inline
Side-by-side
src/main/java/org/opengroup/osdu/azure/entitlements/service/EntitlementsAzure.java
View file @
72142151
...
@@ -14,6 +14,7 @@
...
@@ -14,6 +14,7 @@
package
org.opengroup.osdu.azure.entitlements.service
;
package
org.opengroup.osdu.azure.entitlements.service
;
import
com.ctc.wstx.util.StringUtil
;
import
com.microsoft.azure.spring.autoconfigure.aad.UserPrincipal
;
import
com.microsoft.azure.spring.autoconfigure.aad.UserPrincipal
;
import
lombok.AllArgsConstructor
;
import
lombok.AllArgsConstructor
;
import
lombok.Data
;
import
lombok.Data
;
...
@@ -34,6 +35,7 @@ import org.springframework.beans.factory.annotation.Value;
...
@@ -34,6 +35,7 @@ import org.springframework.beans.factory.annotation.Value;
import
org.springframework.security.core.Authentication
;
import
org.springframework.security.core.Authentication
;
import
org.springframework.security.core.context.SecurityContextHolder
;
import
org.springframework.security.core.context.SecurityContextHolder
;
import
org.springframework.stereotype.Service
;
import
org.springframework.stereotype.Service
;
import
org.springframework.util.StringUtils
;
import
java.util.*
;
import
java.util.*
;
import
java.util.regex.Matcher
;
import
java.util.regex.Matcher
;
...
@@ -400,8 +402,10 @@ public class EntitlementsAzure
...
@@ -400,8 +402,10 @@ public class EntitlementsAzure
type
=
UserType
.
REGULAR_USER
;
type
=
UserType
.
REGULAR_USER
;
else
if
(
u
.
getUniqueName
()
!=
null
)
else
if
(
u
.
getUniqueName
()
!=
null
)
type
=
UserType
.
GUEST_USER
;
type
=
UserType
.
GUEST_USER
;
else
else
if
(!
StringUtils
.
isEmpty
(
u
.
getClaim
(
"appid"
)))
type
=
UserType
.
SERVICE_PRINCIPAL
;
type
=
UserType
.
SERVICE_PRINCIPAL
;
else
type
=
UserType
.
OTHER
;
return
type
;
return
type
;
}
}
...
@@ -455,6 +459,12 @@ public class EntitlementsAzure
...
@@ -455,6 +459,12 @@ public class EntitlementsAzure
}
else
if
(
type
==
UserType
.
SERVICE_PRINCIPAL
){
}
else
if
(
type
==
UserType
.
SERVICE_PRINCIPAL
){
context
.
setUid
(
userPrincipal
.
getClaim
(
"appid"
).
toString
());
context
.
setUid
(
userPrincipal
.
getClaim
(
"appid"
).
toString
());
context
.
setOid
(
userPrincipal
.
getClaim
(
"oid"
).
toString
());
context
.
setOid
(
userPrincipal
.
getClaim
(
"oid"
).
toString
());
}
else
if
(
type
==
UserType
.
OTHER
){
String
oId
=
userPrincipal
.
getClaim
(
"email"
).
toString
();
if
(
StringUtils
.
isEmpty
(
oId
))
{
oId
=
userPrincipal
.
getClaim
(
"appcode"
).
toString
();
}
context
.
setOid
(
oId
);
}
}
return
context
;
return
context
;
}
}
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new 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