Package com.nimbusds.common.id
Class AuthzId
java.lang.Object
com.nimbusds.common.id.BaseIdentifier
com.nimbusds.common.id.AuthzId
- All Implemented Interfaces:
Identifier
,Comparable<Identifier>
,net.minidev.json.JSONAware
Represents a SASL authorisation identity, as specified in RFC 4513, section
5.2.1.8. This can be a distinguished name (DN) or a username.
Note that for the purpose of keying and comparing authorisation identities, the DNs are normalised and the usernames are converted to lower case.
DN form:
"dn: uid=alice,ou=people,dc=wonderland,dc=net"
Username form:
"u: alice"
-
Nested Class Summary
-
Field Summary
Fields inherited from class com.nimbusds.common.id.BaseIdentifier
DEFAULT_BYTE_LENGTH, SECURE_RANDOM
-
Constructor Summary
-
Method Summary
Methods inherited from class com.nimbusds.common.id.BaseIdentifier
compareTo, hashCode, toJSONString, toString
-
Field Details
-
ANONYMOUS
Anonymous user identity.
-
-
Constructor Details
-
AuthzId
Creates a new authorisation identity from the specified DN.Note that for the purpose of keying and comparing authorisation IDs, the DN will be normalised (simple normalisation, without consulting the schema).
- Parameters:
dn
- The DN, must not benull
. IfDN.NULL_DN
indicates an anonymous user.
-
AuthzId
Creates a new authorisation identity from the specified username.Note that for the purpose of keying and comparing authorisation IDs, the username will be converted to lower case.
- Parameters:
username
- The username, must not benull
. If empty indicates an anonymous user.
-
-
Method Details
-
parse
Parses a string representation of a SASL authorisation identity.- Parameters:
value
- The string to parse, ifnull
or emptyANONYMOUS
is returned.- Returns:
- The parsed authorisation identity.
- Throws:
ParseException
- On a bad authzid syntax.
-
getIdentityType
Gets the identity type.- Returns:
- The identity type.
-
getDN
Gets the identity DN.- Returns:
- The DN,
null
if specified as a username instead.
-
getUsername
Gets the identity username.- Returns:
- The username,
null
if specified as a DN instead.
-
equals
Description copied from class:BaseIdentifier
OverridesObject.equals()
.- Specified by:
equals
in classBaseIdentifier
- Parameters:
object
- The object to compare to.- Returns:
true
if the objects have the same value, otherwisefalse
.
-