Class BootAuthenticator<T>
java.lang.Object
org.summerboot.jexpress.security.auth.BootAuthenticator<T>
- Type Parameters:
T- authenticate(T metaData)
- All Implemented Interfaces:
Authenticator
- Direct Known Subclasses:
AuthenticatorMockImpl
- Author:
- Changski Tie Zheng Zhang 张铁铮, 魏泽北, 杜旺财, 杜富贵
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected abstract Callerauthenticate(String uid, String password, T metaData, AuthenticatorListener listener, ServiceContext context) fromJwt(io.jsonwebtoken.Claims claims) Convert Caller back from auth token, override this method to implement customized token formatgetBearerToken(io.netty.handler.codec.http.HttpHeaders httpRequestHeaders) Retrieve token based on RFC 6750 - The OAuth 2.0 Authorization Framework override this method to get customized tokenlogin(String uid, String pwd, Object metaData, int validForMinutes, ServiceContext context) Success HTTP Status: 201 Createdvoidlogout(io.netty.handler.codec.http.HttpHeaders httpRequestHeaders, AuthTokenCache cache, ServiceContext context) Success HTTP Status: 204 No Contentvoidlogout(String authToken, AuthTokenCache cache, ServiceContext context) Success HTTP Status: 204 No Contentprotected IntegervoidsetListener(AuthenticatorListener listener) io.jsonwebtoken.JwtBuilderConvert Caller to auth token, override this method to implement customized token formatverifyBearerToken(io.netty.handler.codec.http.HttpHeaders httpRequestHeaders, AuthTokenCache cache, Integer errorCode, ServiceContext context) Success HTTP Status: 200 OKverifyToken(String authToken, AuthTokenCache cache, Integer errorCode, ServiceContext context) Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.summerboot.jexpress.security.auth.Authenticator
preAccessCheck
-
Field Details
-
listener
-
authCfg
-
-
Constructor Details
-
BootAuthenticator
public BootAuthenticator()
-
-
Method Details
-
setListener
- Specified by:
setListenerin interfaceAuthenticator- Parameters:
listener-
-
login
public String login(String uid, String pwd, Object metaData, int validForMinutes, ServiceContext context) throws NamingException Description copied from interface:AuthenticatorSuccess HTTP Status: 201 Created- Specified by:
loginin interfaceAuthenticator- Parameters:
uid-pwd-validForMinutes-context-- Returns:
- Throws:
NamingException
-
authenticate
protected abstract Caller authenticate(String uid, String password, T metaData, AuthenticatorListener listener, ServiceContext context) throws NamingException - Parameters:
uid-password-metaData-listener-context-- Returns:
- Throws:
NamingException
-
toJwt
Convert Caller to auth token, override this method to implement customized token format- Specified by:
toJwtin interfaceAuthenticator- Parameters:
caller-- Returns:
- formatted auth token builder
-
fromJwt
Convert Caller back from auth token, override this method to implement customized token format- Specified by:
fromJwtin interfaceAuthenticator- Parameters:
claims-- Returns:
- Caller
-
getBearerToken
Description copied from interface:AuthenticatorRetrieve token based on RFC 6750 - The OAuth 2.0 Authorization Framework override this method to get customized token- Specified by:
getBearerTokenin interfaceAuthenticator- Parameters:
httpRequestHeaders-- Returns:
-
verifyBearerToken
public Caller verifyBearerToken(io.netty.handler.codec.http.HttpHeaders httpRequestHeaders, AuthTokenCache cache, Integer errorCode, ServiceContext context) Description copied from interface:AuthenticatorSuccess HTTP Status: 200 OK- Specified by:
verifyBearerTokenin interfaceAuthenticator- Parameters:
httpRequestHeaders-cache-errorCode-context-- Returns:
-
verifyToken
public Caller verifyToken(String authToken, AuthTokenCache cache, Integer errorCode, ServiceContext context) - Specified by:
verifyTokenin interfaceAuthenticator- Parameters:
authToken-cache-errorCode-context-- Returns:
-
overrideVerifyTokenErrorCode
-
logout
public void logout(io.netty.handler.codec.http.HttpHeaders httpRequestHeaders, AuthTokenCache cache, ServiceContext context) Description copied from interface:AuthenticatorSuccess HTTP Status: 204 No Content- Specified by:
logoutin interfaceAuthenticator- Parameters:
httpRequestHeaders-cache-context-
-
logout
Description copied from interface:AuthenticatorSuccess HTTP Status: 204 No Content- Specified by:
logoutin interfaceAuthenticator- Parameters:
authToken-cache-context-
-