Class BootAuthenticator
java.lang.Object
org.summerboot.jexpress.security.auth.BootAuthenticator
- All Implemented Interfaces:
HealthInspector,Authenticator
- Direct Known Subclasses:
AuthenticatorMockImpl
- Author:
- Changski Tie Zheng Zhang 张铁铮, 魏泽北, 杜旺财, 杜富贵
-
Field Summary
FieldsFields inherited from interface org.summerboot.jexpress.boot.instrumentation.HealthInspector
healthInspectorCounter -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionauthenticate(String uid, String pwd, int validForMinutes, ServiceContext context) Success HTTP Status: 201 CreatedfromJwt(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 tokenprotected abstract Callerlogin(String uid, String password, AuthenticatorListener listener) voidlogout(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 ContentvoidsetListener(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.boot.instrumentation.HealthInspector
ping
-
Field Details
-
listener
-
authCfg
-
-
Constructor Details
-
BootAuthenticator
public BootAuthenticator()
-
-
Method Details
-
setListener
- Specified by:
setListenerin interfaceAuthenticator- Parameters:
listener-
-
authenticate
public String authenticate(String uid, String pwd, int validForMinutes, ServiceContext context) throws IOException, NamingException Description copied from interface:AuthenticatorSuccess HTTP Status: 201 Created- Specified by:
authenticatein interfaceAuthenticator- Parameters:
uid-pwd-validForMinutes-context-- Returns:
- Throws:
IOExceptionNamingException
-
login
protected abstract Caller login(String uid, String password, AuthenticatorListener listener) throws IOException, NamingException - Parameters:
uid-password-listener-- Returns:
- Throws:
IOExceptionNamingException
-
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:
-
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-
-