gluu
公開メンバ関数 | 全メンバ一覧
org.xdi.oxauth.model.common.RefreshToken クラス
org.xdi.oxauth.model.common.RefreshToken の継承関係図
Inheritance graph
org.xdi.oxauth.model.common.RefreshToken 連携図
Collaboration graph

公開メンバ関数

 RefreshToken (int lifeTime)
 
 RefreshToken (String code, Date creationDate, Date expirationDate)
 
void checkExpired ()
 
void checkExpired (Date now)
 
boolean isValid ()
 
String getCode ()
 
void setCode (String code)
 
Date getCreationDate ()
 
void setCreationDate (Date creationDate)
 
Date getExpirationDate ()
 
void setExpirationDate (Date expirationDate)
 
boolean isRevoked ()
 
synchronized void setRevoked (boolean revoked)
 
boolean isExpired ()
 
synchronized void setExpired (boolean expired)
 
String getAuthMode ()
 
void setAuthMode (String authMode)
 
String getSessionDn ()
 
void setSessionDn (String sessionDn)
 
int getExpiresIn ()
 
String getHash (SignatureAlgorithm signatureAlgorithm)
 

詳解

Authorization servers MAY issue refresh tokens to web application clients and native application clients.

Refresh tokens MUST be kept confidential in transit and storage, and shared only among the authorization server and the client to whom the refresh tokens were issued.

The authorization server MUST maintain the binding between a refresh token and the client to whom it was issued. The authorization server MUST verify the binding between the refresh token and client identity whenever the client identity can be authenticated. When client authentication is not possible, the authorization server SHOULD deploy other means to detect refresh token abuse.

For example, the authorization server could employ refresh token rotation in which a new refresh token is issued with every access token refresh response. The previous refresh token is invalidated but retained by the authorization server. If a refresh token is compromised and subsequently used by both the attacker and the legitimate client, one of them will present an invalidated refresh token which will inform the authorization server of the breach.

The authorization server MUST ensure that refresh tokens cannot be generated, modified, or guessed to produce valid refresh tokens by unauthorized parties.

著者
Javier Rojas Date: 09.29.2011

構築子と解体子

◆ RefreshToken() [1/2]

org.xdi.oxauth.model.common.RefreshToken.RefreshToken ( int  lifeTime)
inline

Constructs a refresh token.

When created, a token is valid for a given lifetime, and after this period of time, it will be marked as expired automatically by a background process.

When required, the token can be marked as revoked.

引数
lifeTimeThe life time of the token.
63  {
64  super(lifeTime);
65  }

◆ RefreshToken() [2/2]

org.xdi.oxauth.model.common.RefreshToken.RefreshToken ( String  code,
Date  creationDate,
Date  expirationDate 
)
inline
67  {
69  }
Date creationDate
Definition: AbstractToken.java:42
Date expirationDate
Definition: AbstractToken.java:44
String code
Definition: AbstractToken.java:40

関数詳解

◆ checkExpired() [1/2]

void org.xdi.oxauth.model.common.AbstractToken.checkExpired ( )
inlineinherited

Checks whether the token has expired and if true, marks itself as expired.

84  {
85  checkExpired(new Date());
86  }
void checkExpired()
Definition: AbstractToken.java:84

◆ checkExpired() [2/2]

void org.xdi.oxauth.model.common.AbstractToken.checkExpired ( Date  now)
inlineinherited

Checks whether the token has expired and if true, marks itself as expired.

91  {
92  if (now.after(expirationDate)) {
93  expired = true;
94  }
95  }
boolean expired
Definition: AbstractToken.java:46
Date expirationDate
Definition: AbstractToken.java:44

◆ getAuthMode()

String org.xdi.oxauth.model.common.AbstractToken.getAuthMode ( )
inlineinherited

Returns the authentication mode.

戻り値
The authentication mode.
204  {
205  return authMode;
206  }
String authMode
Definition: AbstractToken.java:49

◆ getCode()

String org.xdi.oxauth.model.common.AbstractToken.getCode ( )
inlineinherited

Returns the token code.

戻り値
The Code of the token.
112  {
113  return code;
114  }
String code
Definition: AbstractToken.java:40

◆ getCreationDate()

Date org.xdi.oxauth.model.common.AbstractToken.getCreationDate ( )
inlineinherited

Returns the creation date of the token.

戻り値
The creation date.
130  {
131  return creationDate != null ? new Date(creationDate.getTime()) : null;
132  }
Date creationDate
Definition: AbstractToken.java:42

◆ getExpirationDate()

Date org.xdi.oxauth.model.common.AbstractToken.getExpirationDate ( )
inlineinherited

Returns the expiration date of the token.

戻り値
The expiration date.
148  {
149  return expirationDate != null ? new Date(expirationDate.getTime()) : null;
150  }
Date expirationDate
Definition: AbstractToken.java:44

◆ getExpiresIn()

int org.xdi.oxauth.model.common.AbstractToken.getExpiresIn ( )
inlineinherited

Returns the lifetime in seconds of the token.

戻り値
The lifetime in seconds of the token.
230  {
231  int expiresIn = 0;
232 
233  checkExpired();
234  if (isValid()) {
235  long diff = expirationDate.getTime() - new Date().getTime();
236  expiresIn = diff != 0 ? (int) (diff / 1000) : 0;
237  }
238 
239  return expiresIn;
240  }
Date expirationDate
Definition: AbstractToken.java:44
boolean isValid()
Definition: AbstractToken.java:103
void checkExpired()
Definition: AbstractToken.java:84

◆ getHash()

String org.xdi.oxauth.model.common.AbstractToken.getHash ( SignatureAlgorithm  signatureAlgorithm)
inlineinherited
242  {
243  String hash = null;
244 
245  try {
246  byte[] digest;
247  if (signatureAlgorithm == SignatureAlgorithm.HS256 ||
248  signatureAlgorithm == SignatureAlgorithm.RS256 ||
249  signatureAlgorithm == SignatureAlgorithm.ES256) {
250  digest = JwtUtil.getMessageDigestSHA256(code);
251  } else if (signatureAlgorithm == SignatureAlgorithm.HS384 ||
252  signatureAlgorithm == SignatureAlgorithm.RS384 ||
253  signatureAlgorithm == SignatureAlgorithm.ES512) {
254  digest = JwtUtil.getMessageDigestSHA384(code);
255  } else if (signatureAlgorithm == SignatureAlgorithm.HS512 ||
256  signatureAlgorithm == SignatureAlgorithm.RS384 ||
257  signatureAlgorithm == SignatureAlgorithm.ES512) {
258  digest = JwtUtil.getMessageDigestSHA512(code);
259  } else { // Default
260  digest = JwtUtil.getMessageDigestSHA256(code);
261  }
262 
263  if (digest != null) {
264  byte[] lefMostHalf = new byte[digest.length / 2];
265  System.arraycopy(digest, 0, lefMostHalf, 0, lefMostHalf.length);
266  hash = Base64Util.base64urlencode(lefMostHalf);
267  }
268  } catch (NoSuchAlgorithmException e) {
269  } catch (UnsupportedEncodingException e) {
270  } catch (NoSuchProviderException e) {
271  } catch (Exception e) {
272  }
273 
274  return hash;
275  }
String code
Definition: AbstractToken.java:40

◆ getSessionDn()

String org.xdi.oxauth.model.common.AbstractToken.getSessionDn ( )
inlineinherited
217  {
218  return sessionDn;
219  }
String sessionDn
Definition: AbstractToken.java:51

◆ isExpired()

boolean org.xdi.oxauth.model.common.AbstractToken.isExpired ( )
inlineinherited

Return true if the token has expired.

戻り値
true if the token has expired.
185  {
186  return expired;
187  }
boolean expired
Definition: AbstractToken.java:46

◆ isRevoked()

boolean org.xdi.oxauth.model.common.AbstractToken.isRevoked ( )
inlineinherited

Returns true if the token has been revoked.

戻り値
true if the token has been revoked.
166  {
167  return revoked;
168  }
boolean revoked
Definition: AbstractToken.java:45

◆ isValid()

boolean org.xdi.oxauth.model.common.AbstractToken.isValid ( )
inlineinherited

Checks whether a token is valid, it is valid if it is not revoked and not expired.

戻り値
Returns true if the token is valid.
103  {
104  return !revoked && !expired;
105  }
boolean expired
Definition: AbstractToken.java:46
boolean revoked
Definition: AbstractToken.java:45

◆ setAuthMode()

void org.xdi.oxauth.model.common.AbstractToken.setAuthMode ( String  authMode)
inlineinherited

Sets the authentication mode.

引数
authModeThe authentication mode.
213  {
214  this.authMode = authMode;
215  }
String authMode
Definition: AbstractToken.java:49

◆ setCode()

void org.xdi.oxauth.model.common.AbstractToken.setCode ( String  code)
inlineinherited

Sets the token code.

引数
codeThe code of the token.
121  {
122  this.code = code;
123  }
String code
Definition: AbstractToken.java:40

◆ setCreationDate()

void org.xdi.oxauth.model.common.AbstractToken.setCreationDate ( Date  creationDate)
inlineinherited

Sets the creation date of the token.

引数
creationDateThe creation date.
139  {
140  this.creationDate = creationDate != null ? new Date(creationDate.getTime()) : null;
141  }
Date creationDate
Definition: AbstractToken.java:42

◆ setExpirationDate()

void org.xdi.oxauth.model.common.AbstractToken.setExpirationDate ( Date  expirationDate)
inlineinherited

Sets the expiration date of the token.

引数
expirationDateThe expiration date.
157  {
158  this.expirationDate = expirationDate != null ? new Date(expirationDate.getTime()) : null;
159  }
Date expirationDate
Definition: AbstractToken.java:44

◆ setExpired()

synchronized void org.xdi.oxauth.model.common.AbstractToken.setExpired ( boolean  expired)
inlineinherited

Sets the value of the expired flag to indicate whether the token has expired.

引数
expiredExpire or not.
195  {
196  this.expired = expired;
197  }
boolean expired
Definition: AbstractToken.java:46

◆ setRevoked()

synchronized void org.xdi.oxauth.model.common.AbstractToken.setRevoked ( boolean  revoked)
inlineinherited

Sets the value of the revoked flag to indicate whether the token has been revoked.

引数
revokedRevoke or not.
176  {
177  this.revoked = revoked;
178  }
boolean revoked
Definition: AbstractToken.java:45

◆ setSessionDn()

void org.xdi.oxauth.model.common.AbstractToken.setSessionDn ( String  sessionDn)
inlineinherited
221  {
222  this.sessionDn = sessionDn;
223  }
String sessionDn
Definition: AbstractToken.java:51

このクラス詳解は次のファイルから抽出されました: