private Response process ( MultivaluedMap < String , String > parameters ) { // Call Authlete's /api/auth/authorization API. AuthorizationResponse response = getApiCaller ( ) . callAuthorization ( parameters ) ; // 'action' in the response denotes the next action which // this service implementation should take. AuthorizationResponse . Action action = response . getAction ( ) ; // The content of the response to the client application. // The format of the content varies depending on the action. String content = response . getResponseContent ( ) ; // Dispatch according to the action. switch ( action ) { case INTERNAL_SERVER_ERROR : // 500 Internal Server Error return ResponseUtil . internalServerError ( content ) ; case BAD_REQUEST : // 400 Bad Request return ResponseUtil . badRequest ( content ) ; case LOCATION : // 302 Found return ResponseUtil . location ( content ) ; case FORM : // 200 OK return ResponseUtil . form ( content ) ; case INTERACTION : // Process the authorization request with user interaction. return handleInteraction ( response ) ; case NO_INTERACTION : // Process the authorization request without user interaction. // The flow reaches here only when the authorization request // contained prompt=none. return handleNoInteraction ( response ) ; default : // This never happens. throw getApiCaller ( ) . unknownAction ( "/api/auth/authorization" , action ) ; } }
Process the authorization request .