@Override protected void shutDown() { try { serviceCancellable.cancel(); server.stop(); grantAccessToken.destroy(); } catch (Exception e) { LOG.error("Error stopping Authentication Server.", e); } } }
/** * Get an AccessToken. */ @Path(Paths.GET_TOKEN) @GET @Produces("application/json") public Response token(@Context HttpServletRequest request, @Context HttpServletResponse response) throws IOException, ServletException { grantToken(request, response, tokenExpiration); return Response.status(200).build(); }
/** * Initializes the handlers. */ private void initHandlers() throws Exception { Map<String, String> handlerProps = new HashMap<>(); // used by CertificateAuthenticationHandler (see CDAP-7287) copyPropIfExists(handlerProps, cConfiguration, "security.auth.server.ssl.truststore.path"); copyPropIfExists(handlerProps, cConfiguration, "security.auth.server.ssl.truststore.type"); copyPropIfExists(handlerProps, cConfiguration, "security.auth.server.ssl.truststore.password"); // used by AbstractAuthenticationHandler copyPropIfExists(handlerProps, cConfiguration, Constants.Security.SSL.EXTERNAL_ENABLED); // used by BasicAuthenticationHandler copyPropIfExists(handlerProps, cConfiguration, Constants.Security.BASIC_REALM_FILE); // used by BJASPIAuthenticationHandler copyPropIfExists(handlerProps, cConfiguration, Constants.Security.LOGIN_MODULE_CLASS_NAME); copyProps(handlerProps, getAuthHandlerConfigs(cConfiguration)); copyProps(handlerProps, getAuthHandlerConfigs(sConfiguration)); authenticationHandler.init(handlerProps); grantAccessToken.init(); }
/** * Get a long lasting Access Token. */ @Path(Paths.GET_EXTENDED_TOKEN) @GET @Produces("application/json") public Response extendedToken(@Context HttpServletRequest request, @Context HttpServletResponse response) throws IOException, ServletException { grantToken(request, response, extendedTokenExpiration); return Response.status(200).build(); }