congrats Icon
New! Announcing Tabnine Chat Beta
Learn More
Tabnine Logo
HttpAuthenticationMechanism
Code IndexAdd Tabnine to your IDE (free)

How to use
HttpAuthenticationMechanism
in
javax.security.enterprise.authentication.mechanism.http

Best Java code snippets using javax.security.enterprise.authentication.mechanism.http.HttpAuthenticationMechanism (Showing top 9 results out of 315)

origin: javaee-samples/javaee8-samples

@Override
public void cleanSubject(HttpServletRequest request, HttpServletResponse response, HttpMessageContext httpMessageContext) {
  getWrapped().cleanSubject(request, response, httpMessageContext);
}
origin: javaee-samples/javaee8-samples

@Override
public AuthenticationStatus secureResponse(HttpServletRequest request, HttpServletResponse response,
    HttpMessageContext httpMessageContext) throws AuthenticationException {
  return getWrapped().secureResponse(request, response, httpMessageContext);
}
origin: javaee-samples/javaee8-samples

@Override
public AuthenticationStatus validateRequest(HttpServletRequest request, HttpServletResponse response,
    HttpMessageContext httpMessageContext) throws AuthenticationException {
  return getWrapped().validateRequest(request, response, httpMessageContext);
}
origin: javaee/security-soteria

status = CDI.current()
      .select(HttpAuthenticationMechanism.class).get()
      .validateRequest(
        msgContext.getRequest(), 
        msgContext.getResponse(), 
origin: javaee/security-soteria

/**
 * Called in response to a {@link HttpServletRequest#logout()} call.
 *
 */
@Override
public void cleanSubject(MessageInfo messageInfo, Subject subject) throws AuthException {
  HttpMessageContext msgContext = new HttpMessageContextImpl(handler, messageInfo, subject);
  
  CDI.current()
    .select(HttpAuthenticationMechanism.class).get()
    .cleanSubject(msgContext.getRequest(), msgContext.getResponse(), msgContext);
}
origin: org.glassfish.soteria/javax.security.enterprise

@Override
public AuthStatus secureResponse(MessageInfo messageInfo, Subject serviceSubject) throws AuthException {
  HttpMessageContext msgContext = new HttpMessageContextImpl(handler, messageInfo, null);
  try {
    AuthenticationStatus status = CDI.current()
                     .select(HttpAuthenticationMechanism.class).get()
                     .secureResponse(
                       msgContext.getRequest(), 
                       msgContext.getResponse(), 
                       msgContext);
    AuthStatus authStatus = fromAuthenticationStatus(status);
    if (authStatus == AuthStatus.SUCCESS) {
      return AuthStatus.SEND_SUCCESS;
    }
    return authStatus;
  } catch (AuthenticationException e) {
    throw (AuthException) new AuthException("Secure response failure in HttpAuthenticationMechanism").initCause(e);
  } finally {
    if (cdiPerRequestInitializer != null) {
      cdiPerRequestInitializer.destroy(msgContext.getRequest());
    }
  }
}
origin: org.glassfish.soteria/javax.security.enterprise

status = CDI.current()
      .select(HttpAuthenticationMechanism.class).get()
      .validateRequest(
        msgContext.getRequest(), 
        msgContext.getResponse(), 
origin: org.glassfish.soteria/javax.security.enterprise

/**
 * Called in response to a {@link HttpServletRequest#logout()} call.
 *
 */
@Override
public void cleanSubject(MessageInfo messageInfo, Subject subject) throws AuthException {
  HttpMessageContext msgContext = new HttpMessageContextImpl(handler, messageInfo, subject);
  
  CDI.current()
    .select(HttpAuthenticationMechanism.class).get()
    .cleanSubject(msgContext.getRequest(), msgContext.getResponse(), msgContext);
}
origin: javaee/security-soteria

@Override
public AuthStatus secureResponse(MessageInfo messageInfo, Subject serviceSubject) throws AuthException {
  HttpMessageContext msgContext = new HttpMessageContextImpl(handler, messageInfo, null);
  try {
    AuthenticationStatus status = CDI.current()
                     .select(HttpAuthenticationMechanism.class).get()
                     .secureResponse(
                       msgContext.getRequest(), 
                       msgContext.getResponse(), 
                       msgContext);
    AuthStatus authStatus = fromAuthenticationStatus(status);
    if (authStatus == AuthStatus.SUCCESS) {
      return AuthStatus.SEND_SUCCESS;
    }
    return authStatus;
  } catch (AuthenticationException e) {
    throw (AuthException) new AuthException("Secure response failure in HttpAuthenticationMechanism").initCause(e);
  } finally {
    if (cdiPerRequestInitializer != null) {
      cdiPerRequestInitializer.destroy(msgContext.getRequest());
    }
  }
}
javax.security.enterprise.authentication.mechanism.httpHttpAuthenticationMechanism

Javadoc

HttpAuthenticationMechanism is a mechanism for obtaining a caller's credentials in some way, using the HTTP protocol where necessary.

This is used to help in securing Servlet endpoints, including endpoints that may be build on top of Servlet like JAX-RS endpoints and JSF views. It specifically is not used for endpoints such as remote EJB beans or (JMS) message driven beans.

A HttpAuthenticationMechanism is essentially a Servlet specific and CDI enabled version of the ServerAuthModule that adheres to the Servlet Container Profile. See the JASPIC spec for further details on this.

Implementations of this class can notify the Servlet container about a successful authentication by using the HttpMessageContext#notifyContainerAboutLogin(java.security.Principal,java.util.Set) method.

Implementations are expected and encouraged to delegate the actual credential validation and/or retrieval of the caller name with optional groups to an IdentityStore. This is however not required and implementations can either do the validation checks for authentication completely autonomously, or delegate only certain aspects of the process to the store (e.g. use the store only for retrieving the groups an authenticated user is in).

Most used methods

  • cleanSubject
    Remove mechanism specific principals and credentials from the subject and any other state the mechan
  • secureResponse
    Secure the response, optionally. This method is called to allow for any post processing to be done o
  • validateRequest
    Authenticate an HTTP request. This method is called in response to an HTTP client request for a reso

Popular in Java

  • Reactive rest calls using spring rest template
  • notifyDataSetChanged (ArrayAdapter)
  • requestLocationUpdates (LocationManager)
  • scheduleAtFixedRate (ScheduledExecutorService)
  • ObjectMapper (com.fasterxml.jackson.databind)
    ObjectMapper provides functionality for reading and writing JSON, either to and from basic POJOs (Pl
  • OutputStream (java.io)
    A writable sink for bytes.Most clients will use output streams that write data to the file system (
  • MessageFormat (java.text)
    Produces concatenated messages in language-neutral way. New code should probably use java.util.Forma
  • Properties (java.util)
    A Properties object is a Hashtable where the keys and values must be Strings. Each property can have
  • ServletException (javax.servlet)
    Defines a general exception a servlet can throw when it encounters difficulty.
  • Response (javax.ws.rs.core)
    Defines the contract between a returned instance and the runtime when an application needs to provid
  • Top PhpStorm plugins
Tabnine Logo
  • Products

    Search for Java codeSearch for JavaScript code
  • IDE Plugins

    IntelliJ IDEAWebStormVisual StudioAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimGoLandRubyMineEmacsJupyter NotebookJupyter LabRiderDataGripAppCode
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogTabnine AcademyTerms of usePrivacy policyJava Code IndexJavascript Code Index
Get Tabnine for your IDE now