Class BaseAuthorizationDecisionEndpoint


  • public class BaseAuthorizationDecisionEndpoint
    extends BaseEndpoint
    A base class for authorization decision endpoints.
    Since:
    1.2
    Author:
    Takahiko Kawasaki
    • Constructor Detail

      • BaseAuthorizationDecisionEndpoint

        public BaseAuthorizationDecisionEndpoint()
    • Method Detail

      • handle

        public javax.ws.rs.core.Response handle​(com.authlete.common.api.AuthleteApi api,
                                                AuthorizationDecisionHandlerSpi spi,
                                                String ticket,
                                                String[] claimNames,
                                                String[] claimLocales)
        Handle an authorization decision request.

        This method internally creates a AuthorizationDecisionHandler instance and calls its AuthorizationDecisionHandler.handle(String, String[], String[]) method. Then, this method uses the value returned from the handle() method as a response from this method.

        When AuthorizationDecisionHandler.handle() method raises a WebApplicationException, this method calls onError() method with the exception. The default implementation of onError() does nothing. You can override the method as necessary. After calling onError() method, this method calls getResponse() method of the exception and uses the returned value as a response from this method.

        Parameters:
        api - An implementation of AuthleteApi.
        spi - An implementation of AuthorizationDecisionHandlerSpi.
        ticket - A ticket that was issued by Authlete's /api/auth/authorization API.
        claimNames - Names of requested claims. Use the value of the claims parameter in a response from Authlete's /api/auth/authorization API.
        claimLocales - Requested claim locales. Use the value of the claimsLocales parameter in a response from Authlete's /api/auth/authorization API.
        Returns:
        A response that should be returned to the client application.
      • handle

        public javax.ws.rs.core.Response handle​(com.authlete.common.api.AuthleteApi api,
                                                AuthorizationDecisionHandlerSpi spi,
                                                AuthorizationDecisionHandler.Params params)
        Handle an authorization decision request.

        This method internally creates a AuthorizationDecisionHandler instance and calls its AuthorizationDecisionHandler.handle(String, String[], String[]) method. Then, this method uses the value returned from the handle() method as a response from this method.

        When AuthorizationDecisionHandler.handle() method raises a WebApplicationException, this method calls onError() method with the exception. The default implementation of onError() does nothing. You can override the method as necessary. After calling onError() method, this method calls getResponse() method of the exception and uses the returned value as a response from this method.

        Parameters:
        api - An implementation of AuthleteApi.
        spi - An implementation of AuthorizationDecisionHandlerSpi.
        params - Parameters necessary to handle the decision.
        Returns:
        A response that should be returned to the client application.
        Since:
        2.26