implemented getExpiresIn() for oauth access token entities.
parent
910839e5d9
commit
77be0d0ea8
|
@ -288,8 +288,19 @@ public class OAuth2AccessTokenEntity implements OAuth2AccessToken {
|
|||
}
|
||||
|
||||
@Override
|
||||
@Transient
|
||||
public int getExpiresIn() {
|
||||
// TODO Auto-generated method stub
|
||||
return 0;
|
||||
|
||||
if (getExpiration() == null) {
|
||||
return -1; // no expiration time
|
||||
} else {
|
||||
int secondsRemaining = (int) ((getExpiration().getTime() - System.currentTimeMillis()) / 1000);
|
||||
if (isExpired()) {
|
||||
return 0; // has an expiration time and expired
|
||||
} else { // has an expiration time and not expired
|
||||
return secondsRemaining;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue