Interface IdentityTypeDefinition
public interface IdentityTypeDefinition
Implementation defined identity type.
Currently it is stateless, but
IdentityType
wraps configuration which in future can be used to
convert also this interface to be stateful and so configurable.- Author:
- K. Benedyczak
-
Method Summary
Modifier and TypeMethodDescriptionconvertFromString
(String stringRepresentation, String remoteIdp, String translationProfile) Creates an IdentityParam from a string representation.createNewIdentity
(String realm, String target, long entityId) Tries to create a new identity.getComparableValue
(String from, String realm, String target) Comparable value must be guaranteed to be unique for the type, i.e.getId()
boolean
boolean
boolean
Checks if the identity is expired.boolean
boolean
toHumanFriendlyString
(MessageSource msg, IdentityParam from) toPrettyString
(IdentityParam from) Similar to#toString()
, but allows for less verbose and more user-friendly output.Similar to#toPrettyString()
, but doesn't return id type prefix.toString
(IdentityParam from) void
Checks if the value is valid
-
Method Details
-
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
Checks if the identity is expired.- Parameters:
identity
- to be checked- Returns:
- true if expired, false otherwise
-
validate
Checks if the value is valid- Throws:
IllegalIdentityValueException
-
getComparableValue
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
Similar to#toString()
, but allows for less verbose and more user-friendly output. -
toPrettyStringNoPrefix
Similar to#toPrettyString()
, but doesn't return id type prefix. -
toString
- Returns:
- full String representation
-
toHumanFriendlyString
- 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
- Returns:
- Name of the type which can be presented to end user.
-
getHumanFriendlyDescription
- Returns:
- Description of the type which can be presented to end user.
-
createNewIdentity
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
-