added getParentKey() to AccessToken interface

This commit is contained in:
Sebastian Sdorra
2018-12-17 13:06:11 +01:00
parent 6f29aed9df
commit af7e776fdd
2 changed files with 13 additions and 0 deletions

View File

@@ -80,8 +80,20 @@ public interface AccessToken {
*/
Date getExpiration();
/**
* Returns refresh expiration of token.
*
* @return refresh expiration
*/
Optional<Date> getRefreshExpiration();
/**
* Returns id of the parent key.
*
* @return parent key id
*/
Optional<String> getParentKey();
/**
* Returns the scope of the token. The scope is able to reduce the permissions of the subject in the context of this
* token. For example we could issue a token which can only be used to read a single repository. for more informations

View File

@@ -87,6 +87,7 @@ public final class JwtAccessToken implements AccessToken {
return ofNullable(claims.get(REFRESHABLE_UNTIL_CLAIM_KEY, Date.class));
}
@Override
public Optional<String> getParentKey() {
return ofNullable(claims.get(PARENT_TOKEN_ID_CLAIM_KEY).toString());
}