Class TokenImpl
- java.lang.Object
-
- org.oa4mp.delegation.common.impl.token.TokenImpl
-
- All Implemented Interfaces:
NewToken
,Token
,Serializable
- Direct Known Subclasses:
AccessTokenImpl
,AuthorizationGrantImpl
,IDTokenImpl
,OA1TokenImpl
,RefreshTokenImpl
public class TokenImpl extends Object implements NewToken
OAuth 1.0 tokens always have an associated shared secret. These do not.Created by Jeff Gaynor
on Mar 16, 2011 at 12:58:52 PM- See Also:
- Serialized Form
-
-
Field Summary
Fields Modifier and Type Field Description static String
EXPIRES_AT
static String
IS_JWT
static String
JTI
static String
PAYLOAD
static String
TOKEN
static String
TOKEN_TYPE
-
Fields inherited from interface edu.uiuc.ncsa.oa4mp.delegation.common.token.NewToken
OLD_SYSTEM_DEFAULT_LIFETIME
-
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description protected StringBuilder
createString()
Does everything but final ].void
decodeToken(String b32Encoded)
String
encodeToken()
boolean
equals(Object obj)
void
fromJSON(net.sf.json.JSONObject json)
long
getExpiresAt()
long
getIssuedAt()
URI
getJti()
If this is a JWT, then this returns the JTI.edu.uiuc.ncsa.security.core.Identifier
getJTIAsIdentifier()
Convenience method to return the JTI as an identifier.long
getLifetime()
net.sf.json.JSONObject
getPayload()
If this token is a JWT, the is the actual payload.String
getToken()
The token.protected String
getTokenType()
URI
getURIToken()
String
getVersion()
boolean
hasPayload()
protected void
init(URI uri)
boolean
isExpired()
boolean
isJWT()
boolean
isOldVersion()
Checks if the version is null, effectively meaning it was created before versions existed.static void
main(String[] args)
protected void
newFromJSON(net.sf.json.JSONObject json)
protected net.sf.json.JSONObject
newToJSON()
void
oldFromJSON(net.sf.json.JSONObject json)
protected net.sf.json.JSONObject
oldToJSON()
void
setExpiresAt(long expiresAt)
void
setIssuedAt(long issuedAt)
void
setJti(URI jti)
void
setJWT(boolean JWT)
void
setLifetime(long lifetime)
void
setPayload(net.sf.json.JSONObject payload)
void
setToken(String token)
void
setToken(URI token)
void
setVersion(String version)
net.sf.json.JSONObject
toJSON()
String
toString()
-
-
-
Field Detail
-
TOKEN_TYPE
public static final String TOKEN_TYPE
- See Also:
- Constant Field Values
-
EXPIRES_AT
public static final String EXPIRES_AT
- See Also:
- Constant Field Values
-
IS_JWT
public static final String IS_JWT
- See Also:
- Constant Field Values
-
PAYLOAD
public static final String PAYLOAD
- See Also:
- Constant Field Values
-
TOKEN
public static final String TOKEN
- See Also:
- Constant Field Values
-
JTI
public static final String JTI
- See Also:
- Constant Field Values
-
-
Method Detail
-
getVersion
public String getVersion()
- Specified by:
getVersion
in interfaceNewToken
-
getJti
public URI getJti()
If this is a JWT, then this returns the JTI. If not, it just returns the token.
-
setJti
public void setJti(URI jti)
-
getJTIAsIdentifier
public edu.uiuc.ncsa.security.core.Identifier getJTIAsIdentifier()
Convenience method to return the JTI as an identifier.- Specified by:
getJTIAsIdentifier
in interfaceNewToken
- Returns:
-
isOldVersion
public boolean isOldVersion()
Checks if the version is null, effectively meaning it was created before versions existed.- Returns:
-
isJWT
public boolean isJWT()
-
setJWT
public void setJWT(boolean JWT)
-
init
protected void init(URI uri)
-
getURIToken
public URI getURIToken()
-
setToken
public void setToken(URI token)
-
setToken
public void setToken(String token)
-
createString
protected StringBuilder createString()
Does everything but final ]. Over-ride this and yourtoString()
will work- Returns:
-
setLifetime
public void setLifetime(long lifetime)
-
getLifetime
public long getLifetime()
- Specified by:
getLifetime
in interfaceNewToken
-
setVersion
public void setVersion(String version)
-
setIssuedAt
public void setIssuedAt(long issuedAt)
-
getIssuedAt
public long getIssuedAt()
- Specified by:
getIssuedAt
in interfaceNewToken
-
newToJSON
protected net.sf.json.JSONObject newToJSON()
-
oldToJSON
protected net.sf.json.JSONObject oldToJSON()
-
hasPayload
public boolean hasPayload()
-
getPayload
public net.sf.json.JSONObject getPayload()
If this token is a JWT, the is the actual payload.- Returns:
-
setPayload
public void setPayload(net.sf.json.JSONObject payload)
-
fromJSON
public void fromJSON(net.sf.json.JSONObject json)
-
getTokenType
protected String getTokenType()
-
oldFromJSON
public void oldFromJSON(net.sf.json.JSONObject json)
-
newFromJSON
protected void newFromJSON(net.sf.json.JSONObject json)
-
encodeToken
public String encodeToken()
- Specified by:
encodeToken
in interfaceNewToken
-
decodeToken
public void decodeToken(String b32Encoded)
- Specified by:
decodeToken
in interfaceNewToken
-
main
public static void main(String[] args)
-
getExpiresAt
public long getExpiresAt()
-
setExpiresAt
public void setExpiresAt(long expiresAt)
-
-