com.github.ibole.infrastructure.security.jwt.TokenAuthenticator Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of infrastructure-all Show documentation
Show all versions of infrastructure-all Show documentation
The all in one project of ibole infrastructure
The newest version!
package com.github.ibole.infrastructure.security.jwt;
/*********************************************************************************************.
*
*
* Copyright 2016, iBole Inc. All rights reserved.
*
*
*********************************************************************************************/
/**
* 创建Token处理接口.
* 管理短有效期的access token和长生命期的refresh token.
* Refresh token并不能用于请求api.它是用来在access token过期后刷新access token的一个标记.
*
* @author bwang ([email protected])
*
*/
public interface TokenAuthenticator {
/**
* Create new access token base on the claim object.
* @param claim JwtObject
* @param refreshToken boolean
* @param sender
* @param receiver
* @return generated token
* @throws TokenParseException
*/
String createAccessToken(JwtObject claim, S sender, R receiver) throws TokenParseException;
/**
* Create new refresh token base on the claim object.
* @param claim JwtObject
* @param refreshToken boolean
* @param sender
* @param receiver
* @return generated token
* @throws TokenParseException
*/
String createRefreshToken(JwtObject claim, S sender, R receiver) throws TokenParseException;
/**
* Renew token base on the old token.
* @param token the old token to be renewed
* @param ttlSeconds the time to live
* @param refreshToken if it is a refresh token
* @param sender
* @param receiver
* @return the new token
* @throws TokenParseException
*/
String renewToken(String token, int ttlSeconds, boolean refreshToken, S sender, R receiver) throws TokenParseException;
/**
* 验证Access Token.
*/
TokenStatus validAccessToken(String token, String clientId, String loginId, S sender, R receiver);
/**
* 验证Refresh Token.
*/
boolean validRefreshToken(String token, String clientId, String loginId, S sender, R receiver);
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy