Interface IdentityTypeDefinition
-
public interface IdentityTypeDefinition
Implementation defined identity type. Currently it is stateless, butIdentityType
wraps configuration which in future can be used to convert also this interface to be stateful and so configurable.- Author:
- K. Benedyczak
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description IdentityParam
convertFromString(String stringRepresentation, String remoteIdp, String translationProfile)
Creates an IdentityParam from a string representation.Identity
createNewIdentity(String realm, String target, long entityId)
Tries to create a new identity.String
getComparableValue(String from, String realm, String target)
Comparable value must be guaranteed to be unique for the type, i.e.String
getDefaultDescriptionKey()
String
getHumanFriendlyDescription(MessageSource msg)
String
getHumanFriendlyName(MessageSource msg)
String
getId()
boolean
isDynamic()
boolean
isEmailVerifiable()
boolean
isExpired(Identity identity)
Checks if the identity is expired.boolean
isRemovable()
boolean
isTargeted()
String
toHumanFriendlyString(MessageSource msg, IdentityParam from)
String
toPrettyString(IdentityParam from)
Similar to#toString()
, but allows for less verbose and more user-friendly output.String
toPrettyStringNoPrefix(IdentityParam from)
Similar to#toPrettyString()
, but doesn't return id type prefix.String
toString(IdentityParam from)
void
validate(String value)
Checks if the value is valid
-
-
-
Method Detail
-
getId
String getId()
- Returns:
- type id
-
getDefaultDescriptionKey
String getDefaultDescriptionKey()
- Returns:
- identity type default description
-
isDynamic
boolean isDynamic()
- Returns:
- if true then the identity type is dynamic, and can not be created manually. Dynamic identities are created automatically.
-
isRemovable
boolean isRemovable()
- Returns:
- false is returned only for dynamic identities, which can not be removed manually. This happens for volatile identities, for instance session-scoped. Those identities can be only reset, i.e. all instances of its type can be removed.
-
isTargeted
boolean isTargeted()
- Returns:
- if true then identities of this type are targeted, i.e. can have a different value
for each and every receiver (target). This implies that the authentication realm and target are mandatory
parameters for the methods as e.g. the
getComparableValue(String, String, String)
.
-
isEmailVerifiable
boolean isEmailVerifiable()
- Returns:
- if true then identities of this type can be confirmed.
-
isExpired
boolean isExpired(Identity identity)
Checks if the identity is expired.- Parameters:
identity
- to be checked- Returns:
- true if expired, false otherwise
-
validate
void validate(String value) throws IllegalIdentityValueException
Checks if the value is valid- Throws:
IllegalIdentityValueException
-
getComparableValue
String getComparableValue(String from, String realm, String target)
Comparable value must be guaranteed to be unique for the type, i.e. if two values are the same (case sensitive), then the identities represent the same principal.- Parameters:
from
- mandatory raw identity valuerealm
- realm value, can be nulltarget
- target for which the identity is going to be used, can be null- Returns:
- comparable value of the string
-
toPrettyString
String toPrettyString(IdentityParam from)
Similar to#toString()
, but allows for less verbose and more user-friendly output.
-
toPrettyStringNoPrefix
String toPrettyStringNoPrefix(IdentityParam from)
Similar to#toPrettyString()
, but doesn't return id type prefix.
-
toString
String toString(IdentityParam from)
- Returns:
- full String representation
-
toHumanFriendlyString
String toHumanFriendlyString(MessageSource msg, IdentityParam from)
- Returns:
- string representation which is most useful for end-user. Note that this representation may even hide the actual value if it is considered cryptic.
-
getHumanFriendlyName
String getHumanFriendlyName(MessageSource msg)
- Returns:
- Name of the type which can be presented to end user.
-
getHumanFriendlyDescription
String getHumanFriendlyDescription(MessageSource msg)
- Returns:
- Description of the type which can be presented to end user.
-
createNewIdentity
Identity createNewIdentity(String realm, String target, long entityId)
Tries to create a new identity. Can be called only for types which report themself as dynamic.- Parameters:
realm
- authentication realm identifier or null if no realm is definedtarget
- null or the receiver of the created identityentityId
- entityId to be set in the returned identity- Returns:
- newly generated identity
- Throws:
IllegalStateException
- if the creation failed: typically when used on a static type.
-
convertFromString
IdentityParam convertFromString(String stringRepresentation, String remoteIdp, String translationProfile) throws IllegalIdentityValueException
Creates an IdentityParam from a string representation. Typically the method is simplistic (i.e. theIdentityTaV.getValue()
, remoteIdp and profile is set to the arguments and type togetId()
), but it can also perform additional parsing to set for instance the confirmation information.- Throws:
IllegalIdentityValueException
-
-