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

How to use
isProtected
method
in
javax.security.enterprise.authentication.mechanism.http.HttpMessageContext

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

origin: javax/javaee-web-api

@Override
public boolean isProtected() {
  return getWrapped().isProtected();
}
origin: javax.security.enterprise/javax.security.enterprise-api

@Override
public boolean isProtected() {
  return getWrapped().isProtected();
}
origin: jakarta.security.enterprise/jakarta.security.enterprise-api

@Override
public boolean isProtected() {
  return getWrapped().isProtected();
}
origin: jboss/jboss-javaee-specs

@Override
public boolean isProtected() {
  return getWrapped().isProtected();
}
origin: javaee/security-soteria

private boolean isOnProtectedURLWithStaleData(HttpMessageContext httpMessageContext) {
  return
    httpMessageContext.isProtected() && 
    
    // When HttpServletRequest#authenticate is called, it counts as "mandated" authentication
    // which here means isProtected() is true. But we want to use HttpServletRequest#authenticate
    // to resume a dialog started by accessing a protected page, so therefore exclude it here.
    !httpMessageContext.isAuthenticationRequest() &&
    getSavedRequest(httpMessageContext.getRequest()) != null &&
    getSavedAuthentication(httpMessageContext.getRequest()) == null &&
        // Some servers consider the Servlet special URL "/j_security_check" as
    // a protected URL
    !httpMessageContext.getRequest().getRequestURI().endsWith("j_security_check");
}

origin: org.glassfish.soteria/javax.security.enterprise

private boolean isOnInitialProtectedURL(HttpMessageContext httpMessageContext) {
  return 
    httpMessageContext.isProtected() &&
    
    // When HttpServletRequest#authenticate is called, it counts as "mandated" authentication
    // which here means isProtected() is true. But we want to use HttpServletRequest#authenticate
    // to resume a dialog started by accessing a protected page, so therefore exclude it here.
    !httpMessageContext.isAuthenticationRequest() &&
    getSavedRequest(httpMessageContext.getRequest()) == null && 
    getSavedAuthentication(httpMessageContext.getRequest()) == null &&
        
    // Some servers consider the Servlet special URL "/j_security_check" as
    // a protected URL
    !httpMessageContext.getRequest().getRequestURI().endsWith("j_security_check");
}

origin: org.glassfish.soteria/javax.security.enterprise

private boolean isOnProtectedURLWithStaleData(HttpMessageContext httpMessageContext) {
  return
    httpMessageContext.isProtected() && 
    
    // When HttpServletRequest#authenticate is called, it counts as "mandated" authentication
    // which here means isProtected() is true. But we want to use HttpServletRequest#authenticate
    // to resume a dialog started by accessing a protected page, so therefore exclude it here.
    !httpMessageContext.isAuthenticationRequest() &&
    getSavedRequest(httpMessageContext.getRequest()) != null &&
    getSavedAuthentication(httpMessageContext.getRequest()) == null &&
        // Some servers consider the Servlet special URL "/j_security_check" as
    // a protected URL
    !httpMessageContext.getRequest().getRequestURI().endsWith("j_security_check");
}

origin: javaee/security-soteria

private boolean isOnInitialProtectedURL(HttpMessageContext httpMessageContext) {
  return 
    httpMessageContext.isProtected() &&
    
    // When HttpServletRequest#authenticate is called, it counts as "mandated" authentication
    // which here means isProtected() is true. But we want to use HttpServletRequest#authenticate
    // to resume a dialog started by accessing a protected page, so therefore exclude it here.
    !httpMessageContext.isAuthenticationRequest() &&
    getSavedRequest(httpMessageContext.getRequest()) == null && 
    getSavedAuthentication(httpMessageContext.getRequest()) == null &&
        
    // Some servers consider the Servlet special URL "/j_security_check" as
    // a protected URL
    !httpMessageContext.getRequest().getRequestURI().endsWith("j_security_check");
}

origin: javaee-samples/javaee8-samples

} else if (context.isProtected()) {
origin: org.glassfish.soteria/javax.security.enterprise

@Override
public AuthenticationStatus validateRequest(HttpServletRequest request, HttpServletResponse response, HttpMessageContext httpMsgContext) throws AuthenticationException {
  String[] credentials = getCredentials(request);
  if (!isEmpty(credentials)) {
    IdentityStoreHandler identityStoreHandler = CDI.current().select(IdentityStoreHandler.class).get();
    CredentialValidationResult result = identityStoreHandler.validate(
        new UsernamePasswordCredential(credentials[0], new Password(credentials[1])));
    if (result.getStatus() == VALID) {
      return httpMsgContext.notifyContainerAboutLogin(
        result.getCallerPrincipal(), result.getCallerGroups());
    }
  }
  if (httpMsgContext.isProtected()) {
    response.setHeader("WWW-Authenticate", format("Basic realm=\"%s\"", basicAuthenticationMechanismDefinition.realmName()));
    return httpMsgContext.responseUnauthorized();
  }
  return httpMsgContext.doNothing();
}
origin: javaee/security-soteria

@Override
public AuthenticationStatus validateRequest(HttpServletRequest request, HttpServletResponse response, HttpMessageContext httpMsgContext) throws AuthenticationException {
  String[] credentials = getCredentials(request);
  if (!isEmpty(credentials)) {
    IdentityStoreHandler identityStoreHandler = CDI.current().select(IdentityStoreHandler.class).get();
    CredentialValidationResult result = identityStoreHandler.validate(
        new UsernamePasswordCredential(credentials[0], new Password(credentials[1])));
    if (result.getStatus() == VALID) {
      return httpMsgContext.notifyContainerAboutLogin(
        result.getCallerPrincipal(), result.getCallerGroups());
    }
  }
  if (httpMsgContext.isProtected()) {
    response.setHeader("WWW-Authenticate", format("Basic realm=\"%s\"", basicAuthenticationMechanismDefinition.realmName()));
    return httpMsgContext.responseUnauthorized();
  }
  return httpMsgContext.doNothing();
}
javax.security.enterprise.authentication.mechanism.httpHttpMessageContextisProtected

Javadoc

Checks if the currently requested resource is protected or not. A protected resource is a resource (e.g. a Servlet, JSF page, JSP page etc) for which a constraint has been defined in e.g. web.xml.

Popular methods of HttpMessageContext

  • doNothing
    Instructs the container to "do nothing". When intending to do nothing, a JSR 375 authentication mech
  • getRequest
    Returns the request object associated with the current request.
  • getResponse
    Returns the response object associated with the current request.
  • notifyContainerAboutLogin
    Convenience method intended to pass the CredentialValidationResult result of an identity store direc
  • responseUnauthorized
    Sets the response status to 401 (unauthorized). As a convenience this method returns SEND_FAILURE, s
  • forward
    Forwards to another resource (servlet, JSP file, or HTML file) on the server. As a convenience this
  • getAuthParameters
    Returns the parameters that were provided with the SecurityContext#authenticate(AuthParameters) call
  • getCallerPrincipal
    Gets the Principal set by a call to notifyContainerAboutLogin().
  • getClientSubject
    Returns the subject for which authentication is to take place.Note: This is a low level object that
  • getGroups
    Gets the groups set by a call to notifyContainerAboutLogin().
  • getHandler
    Returns the low level JSR 196 handler that the runtime provided when creating this HttpMessageContex
  • getMessageInfo
    Returns the the low level JSR 196 message info instance for the current request.Note: This is a low
  • getHandler,
  • getMessageInfo,
  • isAuthenticationRequest,
  • redirect,
  • withRequest,
  • cleanClientSubject,
  • isRegisterSession,
  • responseNotFound,
  • setRegisterSession

Popular in Java

  • Creating JSON documents from java classes using gson
  • runOnUiThread (Activity)
  • notifyDataSetChanged (ArrayAdapter)
  • compareTo (BigDecimal)
  • Dictionary (java.util)
    Note: Do not use this class since it is obsolete. Please use the Map interface for new implementatio
  • TimeZone (java.util)
    TimeZone represents a time zone offset, and also figures out daylight savings. Typically, you get a
  • ImageIO (javax.imageio)
  • HttpServletRequest (javax.servlet.http)
    Extends the javax.servlet.ServletRequest interface to provide request information for HTTP servlets.
  • JButton (javax.swing)
  • Table (org.hibernate.mapping)
    A relational table
  • Top Vim 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