Class BootAuthenticator
java.lang.Object
org.summerboot.jexpress.security.auth.BootAuthenticator
- All Implemented Interfaces:
HealthInspector,Authenticator
- 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 Createdprotected abstract CallerauthenticateCaller(String uid, String password, AuthenticatorListener listener) getBearerToken(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 tokenvoidlogout(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 Contentio.jsonwebtoken.JwtBuildermarshalCaller(Caller caller) Convert Caller to auth token, override this method to implement customized token formatvoidsetListener(AuthenticatorListener listener) unmarshalCaller(io.jsonwebtoken.Claims claims) Convert Caller back from 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
-
-
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
-
authenticateCaller
protected abstract Caller authenticateCaller(String uid, String password, AuthenticatorListener listener) throws IOException, NamingException - Parameters:
uid-password-listener-- Returns:
- Throws:
IOExceptionNamingException
-
marshalCaller
Convert Caller to auth token, override this method to implement customized token format- Specified by:
marshalCallerin interfaceAuthenticator- Parameters:
caller-- Returns:
- formatted auth token builder
-
unmarshalCaller
Convert Caller back from auth token, override this method to implement customized token format- Specified by:
unmarshalCallerin 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-
-