|
Message Security Layer (MSL) | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.netflix.msl.tokens.UserIdToken
public class UserIdToken
A user ID token provides proof of user identity. While there can be multiple versions of a user ID token, this class should encapsulate support for all of those versions.
User ID tokens are bound to a specific master token by the master token's serial number.
The renewal window indicates the time after which the user ID token will be renewed if requested by the entity. The expiration is the time after which the user ID token will be renewed no matter what.
User ID tokens are represented as
useridtoken = {
"#mandatory" : [ "tokendata", "signature" ],
"tokendata" : "base64",
"signature" : "base64"
}
where:
tokendata
is the Base64-encoded user ID token data (usertokendata)signature
is the Base64-encoded verification data of the user ID token dataThe token data is represented as
usertokendata = {
"#mandatory" : [ "renewalwindow", "expiration", "mtserialnumber", "serialnumber", "userdata" ],
"renewalwindow" : "int64(0,-)",
"expiration" : "int64(0,-)",
"mtserialnumber" : "int64(0,2^53^)",
"serialnumber" : "int64(0,2^53^)",
"userdata" : "base64"
}
where:
renewalwindow
is when the renewal window opens in seconds since the epochexpiration
is the expiration timestamp in seconds since the epochmtserialnumber
is the master token serial numberserialnumber
is the user ID token serial numberuserdata
is the Base64-encoded encrypted user data (userdata)The decrypted user data is represented as
userdata = {
"#mandatory" : [ "user" ],
"issuerdata" : object,
"identity" : "string"
}
where:
issuerdata
is the user ID token issuer dataidentity
is the encoded user identity data
Field Summary | |
---|---|
private MslContext |
ctx
MSL context. |
private long |
expiration
User ID token expiration in seconds since the epoch. |
private JSONObject |
issuerData
Issuer data. |
private static String |
KEY_EXPIRATION
JSON key expiration timestamp. |
private static String |
KEY_IDENTITY
JSON key identity. |
private static String |
KEY_ISSUER_DATA
JSON key issuer data. |
private static String |
KEY_MASTER_TOKEN_SERIAL_NUMBER
JSON key master token serial number. |
private static String |
KEY_RENEWAL_WINDOW
JSON key renewal window timestamp. |
private static String |
KEY_SERIAL_NUMBER
JSON key user ID token serial number. |
private static String |
KEY_SIGNATURE
JSON key signature. |
private static String |
KEY_TOKENDATA
JSON key token data. |
private static String |
KEY_USERDATA
JSON key token user data. |
private static long |
MILLISECONDS_PER_SECOND
Milliseconds per second. |
private long |
mtSerialNumber
Master token serial number. |
private long |
renewalWindow
User ID token renewal window in seconds since the epoch. |
private long |
serialNumber
Serial number. |
private byte[] |
signature
Encrypted token data signature. |
private byte[] |
tokendata
Token data. |
private MslUser |
user
MSL user. |
private byte[] |
userdata
User data. |
private boolean |
verified
Token is verified. |
Constructor Summary | |
---|---|
UserIdToken(MslContext ctx,
Date renewalWindow,
Date expiration,
MasterToken masterToken,
long serialNumber,
JSONObject issuerData,
MslUser user)
Create a new user ID token with the specified user. |
|
UserIdToken(MslContext ctx,
JSONObject userIdTokenJO,
MasterToken masterToken)
Create a new user ID token from the provided JSON object. |
Method Summary | |
---|---|
boolean |
equals(Object obj)
|
Date |
getExpiration()
|
JSONObject |
getIssuerData()
|
long |
getMasterTokenSerialNumber()
Return the serial number of the master token this user ID token is bound to. |
Date |
getRenewalWindow()
|
long |
getSerialNumber()
|
MslUser |
getUser()
|
int |
hashCode()
|
boolean |
isBoundTo(MasterToken masterToken)
|
boolean |
isDecrypted()
|
boolean |
isExpired()
|
boolean |
isRenewable()
|
boolean |
isVerified()
|
String |
toJSONString()
|
String |
toString()
|
Methods inherited from class java.lang.Object |
---|
clone, finalize, getClass, notify, notifyAll, wait, wait, wait |
Field Detail |
---|
private static final long MILLISECONDS_PER_SECOND
private static final String KEY_TOKENDATA
private static final String KEY_SIGNATURE
private static final String KEY_RENEWAL_WINDOW
private static final String KEY_EXPIRATION
private static final String KEY_MASTER_TOKEN_SERIAL_NUMBER
private static final String KEY_SERIAL_NUMBER
private static final String KEY_USERDATA
private static final String KEY_ISSUER_DATA
private static final String KEY_IDENTITY
private final MslContext ctx
private final byte[] tokendata
private final byte[] signature
private final long renewalWindow
private final long expiration
private final long mtSerialNumber
private final long serialNumber
private final byte[] userdata
private final JSONObject issuerData
private final MslUser user
private final boolean verified
Constructor Detail |
---|
public UserIdToken(MslContext ctx, Date renewalWindow, Date expiration, MasterToken masterToken, long serialNumber, JSONObject issuerData, MslUser user) throws MslEncodingException, MslCryptoException
ctx
- MSL context.renewalWindow
- the renewal window.expiration
- the expiration.masterToken
- the master token.serialNumber
- the user ID token serial number.issuerData
- the issuer data. May be null.user
- the MSL user.
MslEncodingException
- if there is an error encoding the JSON
data.
MslCryptoException
- if there is an error encrypting or signing
the token data.public UserIdToken(MslContext ctx, JSONObject userIdTokenJO, MasterToken masterToken) throws MslEncodingException, MslCryptoException, MslException
ctx
- MSL context.userIdTokenJO
- user ID token JSON object.masterToken
- the master token.
MslEncodingException
- if there is an error parsing the JSON, the
token data is missing or invalid, or the signature is invalid.
MslCryptoException
- if there is an error verifying the token
data.
MslException
- if the user ID token master token serial number
does not match the master token serial number, or the expiration
timestamp occurs before the renewal window, or the user data is
missing or invalid, or the user ID token master token serial
number is out of range, or the user ID token serial number is
out of range.Method Detail |
---|
public boolean isDecrypted()
public boolean isVerified()
public Date getRenewalWindow()
public boolean isRenewable()
public Date getExpiration()
public boolean isExpired()
public JSONObject getIssuerData()
public MslUser getUser()
public long getSerialNumber()
public long getMasterTokenSerialNumber()
public boolean isBoundTo(MasterToken masterToken)
masterToken
- master token. May be null.
public final String toJSONString()
public String toString()
toString
in class Object
public boolean equals(Object obj)
equals
in class Object
obj
- the reference object with which to compare.
Object.equals(java.lang.Object)
public int hashCode()
hashCode
in class Object
|
Message Security Layer (MSL) | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |