implemented getExpiresIn() for oauth access token entities.

pull/419/merge
William Kim 2013-07-11 15:02:54 -04:00
parent 910839e5d9
commit 77be0d0ea8
1 changed files with 13 additions and 2 deletions

View File

@ -288,8 +288,19 @@ public class OAuth2AccessTokenEntity implements OAuth2AccessToken {
} }
@Override @Override
@Transient
public int getExpiresIn() { 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;
}
}
} }
} }