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 pl.edu.icm.unity.types.basic.IdentityParam
convertFromString(java.lang.String stringRepresentation, java.lang.String remoteIdp, java.lang.String translationProfile)
Creates an IdentityParam from a string representation.pl.edu.icm.unity.types.basic.Identity
createNewIdentity(java.lang.String realm, java.lang.String target, long entityId)
Tries to create a new identity.java.lang.String
getComparableValue(java.lang.String from, java.lang.String realm, java.lang.String target)
Comparable value must be guaranteed to be unique for the type, i.e.java.lang.String
getDefaultDescriptionKey()
java.lang.String
getHumanFriendlyDescription(pl.edu.icm.unity.MessageSource msg)
java.lang.String
getHumanFriendlyName(pl.edu.icm.unity.MessageSource msg)
java.lang.String
getId()
boolean
isDynamic()
boolean
isEmailVerifiable()
boolean
isExpired(pl.edu.icm.unity.types.basic.Identity identity)
Checks if the identity is expired.boolean
isRemovable()
boolean
isTargeted()
java.lang.String
toHumanFriendlyString(pl.edu.icm.unity.MessageSource msg, pl.edu.icm.unity.types.basic.IdentityParam from)
java.lang.String
toPrettyString(pl.edu.icm.unity.types.basic.IdentityParam from)
Similar to#toString()
, but allows for less verbose and more user-friendly output.java.lang.String
toPrettyStringNoPrefix(pl.edu.icm.unity.types.basic.IdentityParam from)
Similar to#toPrettyString()
, but doesn't return id type prefix.java.lang.String
toString(pl.edu.icm.unity.types.basic.IdentityParam from)
void
validate(java.lang.String value)
Checks if the value is valid
-
-
-
Method Detail
-
getId
java.lang.String getId()
- Returns:
- type id
-
getDefaultDescriptionKey
java.lang.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(pl.edu.icm.unity.types.basic.Identity identity)
Checks if the identity is expired.- Parameters:
identity
- to be checked- Returns:
- true if expired, false otherwise
-
validate
void validate(java.lang.String value) throws pl.edu.icm.unity.exceptions.IllegalIdentityValueException
Checks if the value is valid- Throws:
pl.edu.icm.unity.exceptions.IllegalIdentityValueException
-
getComparableValue
java.lang.String getComparableValue(java.lang.String from, java.lang.String realm, java.lang.String target) throws pl.edu.icm.unity.exceptions.IllegalIdentityValueException
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
- Throws:
pl.edu.icm.unity.exceptions.IllegalIdentityValueException
- if some parameters are null and the implementation requires them to create a comparable value.
-
toPrettyString
java.lang.String toPrettyString(pl.edu.icm.unity.types.basic.IdentityParam from)
Similar to#toString()
, but allows for less verbose and more user-friendly output.
-
toPrettyStringNoPrefix
java.lang.String toPrettyStringNoPrefix(pl.edu.icm.unity.types.basic.IdentityParam from)
Similar to#toPrettyString()
, but doesn't return id type prefix.
-
toString
java.lang.String toString(pl.edu.icm.unity.types.basic.IdentityParam from)
- Returns:
- full String representation
-
toHumanFriendlyString
java.lang.String toHumanFriendlyString(pl.edu.icm.unity.MessageSource msg, pl.edu.icm.unity.types.basic.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
java.lang.String getHumanFriendlyName(pl.edu.icm.unity.MessageSource msg)
- Returns:
- Name of the type which can be presented to end user.
-
getHumanFriendlyDescription
java.lang.String getHumanFriendlyDescription(pl.edu.icm.unity.MessageSource msg)
- Returns:
- Description of the type which can be presented to end user.
-
createNewIdentity
pl.edu.icm.unity.types.basic.Identity createNewIdentity(java.lang.String realm, java.lang.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:
java.lang.IllegalStateException
- if the creation failed: typically when used on a static type.
-
convertFromString
pl.edu.icm.unity.types.basic.IdentityParam convertFromString(java.lang.String stringRepresentation, java.lang.String remoteIdp, java.lang.String translationProfile) throws pl.edu.icm.unity.exceptions.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:
pl.edu.icm.unity.exceptions.IllegalIdentityValueException
-
-