Package org.keycloak.broker.provider
Class BrokeredIdentityContext
- java.lang.Object
-
- org.keycloak.broker.provider.BrokeredIdentityContext
-
public class BrokeredIdentityContext extends Object
Represents all identity information obtained from an
IdentityProvider
after a successful authentication.- Author:
- Pedro Igor
-
-
Constructor Summary
Constructors Constructor Description BrokeredIdentityContext(String id)
-
Method Summary
All Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description void
addMapperAssignedGroup(String groupId)
Adds the specified group to the set of groups assigned by mappers.void
addMapperGrantedRole(String roleName)
Adds the specified role to the set of roles granted by mappers.AuthenticationSessionModel
getAuthenticationSession()
String
getBrokerSessionId()
String
getBrokerUserId()
Map<String,Object>
getContextData()
String
getEmail()
String
getFirstName()
String
getId()
IdentityProvider
getIdp()
IdentityProviderModel
getIdpConfig()
String
getLastName()
String
getLegacyId()
ID from older API version.String
getModelUsername()
username to store in UserModelString
getToken()
String
getUserAttribute(String attributeName)
String
getUsername()
Username in remote idpboolean
hasMapperAssignedGroup(String groupId)
Verifies if a mapper has already assigned the specified group.boolean
hasMapperGrantedRole(String roleName)
Verifies if a mapper has already granted the specified role.void
removeUserAttribute(String attributeName)
void
setAuthenticationSession(AuthenticationSessionModel authenticationSession)
void
setBrokerSessionId(String brokerSessionId)
void
setBrokerUserId(String brokerUserId)
void
setContextData(Map<String,Object> contextData)
void
setEmail(String email)
void
setFirstName(String firstName)
void
setId(String id)
void
setIdp(IdentityProvider idp)
void
setIdpConfig(IdentityProviderModel idpConfig)
void
setLastName(String lastName)
void
setLegacyId(String legacyId)
void
setModelUsername(String modelUsername)
void
setName(String name)
Deprecated.usesetFirstName(String)
andsetLastName(String)
insteadvoid
setToken(String token)
void
setUserAttribute(String attributeName, String attributeValue)
void
setUserAttribute(String attributeName, List<String> attributeValues)
void
setUsername(String username)
String
toString()
-
-
-
Constructor Detail
-
BrokeredIdentityContext
public BrokeredIdentityContext(String id)
-
-
Method Detail
-
getId
public String getId()
-
setId
public void setId(String id)
-
getLegacyId
public String getLegacyId()
ID from older API version. For API migrations.- Returns:
- legacy ID
-
setLegacyId
public void setLegacyId(String legacyId)
-
getUsername
public String getUsername()
Username in remote idp- Returns:
-
setUsername
public void setUsername(String username)
-
getModelUsername
public String getModelUsername()
username to store in UserModel- Returns:
-
setModelUsername
public void setModelUsername(String modelUsername)
-
getEmail
public String getEmail()
-
setEmail
public void setEmail(String email)
-
getBrokerSessionId
public String getBrokerSessionId()
-
setBrokerSessionId
public void setBrokerSessionId(String brokerSessionId)
-
getBrokerUserId
public String getBrokerUserId()
-
setBrokerUserId
public void setBrokerUserId(String brokerUserId)
-
getToken
public String getToken()
-
setToken
public void setToken(String token)
-
getIdpConfig
public IdentityProviderModel getIdpConfig()
-
setIdpConfig
public void setIdpConfig(IdentityProviderModel idpConfig)
-
getIdp
public IdentityProvider getIdp()
-
setIdp
public void setIdp(IdentityProvider idp)
-
removeUserAttribute
public void removeUserAttribute(String attributeName)
-
getFirstName
public String getFirstName()
-
setFirstName
public void setFirstName(String firstName)
-
getLastName
public String getLastName()
-
setLastName
public void setLastName(String lastName)
-
getAuthenticationSession
public AuthenticationSessionModel getAuthenticationSession()
-
setAuthenticationSession
public void setAuthenticationSession(AuthenticationSessionModel authenticationSession)
-
hasMapperGrantedRole
public boolean hasMapperGrantedRole(String roleName)
Verifies if a mapper has already granted the specified role.- Parameters:
roleName
- the name of the role.- Returns:
true
if a mapper has already granted the role;false
otherwise.
-
hasMapperAssignedGroup
public boolean hasMapperAssignedGroup(String groupId)
Verifies if a mapper has already assigned the specified group.- Parameters:
groupId
- the id of the group.- Returns:
true
if a mapper has already assigned the group;false
otherwise.
-
addMapperGrantedRole
public void addMapperGrantedRole(String roleName)
Adds the specified role to the set of roles granted by mappers.- Parameters:
roleName
- the name of the role.
-
addMapperAssignedGroup
public void addMapperAssignedGroup(String groupId)
Adds the specified group to the set of groups assigned by mappers.- Parameters:
groupId
- the id of the group.
-
setName
@Deprecated public void setName(String name)
Deprecated.usesetFirstName(String)
andsetLastName(String)
instead- Parameters:
name
-
-
-