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

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

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

origin: javaee-samples/javaee8-samples

@BasicAuthenticationMechanismDefinition(
  realmName="foo"
origin: javaee/security-soteria

public static boolean hasAnyELExpression(BasicAuthenticationMechanismDefinition in) {
  return AnnotationELPProcessor.hasAnyELExpression(
      in.realmName());
}
origin: javaee/security-examples

@BasicAuthenticationMechanismDefinition(
  realmName="Soteria Realm"
origin: org.glassfish.soteria/javax.security.enterprise

public static boolean hasAnyELExpression(BasicAuthenticationMechanismDefinition in) {
  return AnnotationELPProcessor.hasAnyELExpression(
      in.realmName());
}
origin: org.glassfish.soteria/javax.security.enterprise

public static BasicAuthenticationMechanismDefinition eval(BasicAuthenticationMechanismDefinition in) {
  if (!hasAnyELExpression(in)) {
    return in;
  }
  
  BasicAuthenticationMechanismDefinitionAnnotationLiteral out =
    new BasicAuthenticationMechanismDefinitionAnnotationLiteral(
        evalImmediate(in.realmName()));
  
  out.setHasDeferredExpressions(hasAnyELExpression(out));
  
  return out;
}

origin: javaee/security-soteria

public static BasicAuthenticationMechanismDefinition eval(BasicAuthenticationMechanismDefinition in) {
  if (!hasAnyELExpression(in)) {
    return in;
  }
  
  BasicAuthenticationMechanismDefinitionAnnotationLiteral out =
    new BasicAuthenticationMechanismDefinitionAnnotationLiteral(
        evalImmediate(in.realmName()));
  
  out.setHasDeferredExpressions(hasAnyELExpression(out));
  
  return out;
}

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();
}
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();
}
javax.security.enterprise.authentication.mechanism.httpBasicAuthenticationMechanismDefinition

Most used methods

  • <init>
  • realmName

Popular in Java

  • Creating JSON documents from java classes using gson
  • scheduleAtFixedRate (Timer)
  • scheduleAtFixedRate (ScheduledExecutorService)
  • addToBackStack (FragmentTransaction)
  • FlowLayout (java.awt)
    A flow layout arranges components in a left-to-right flow, much like lines of text in a paragraph. F
  • Date (java.util)
    A specific moment in time, with millisecond precision. Values typically come from System#currentTime
  • List (java.util)
    An ordered collection (also known as a sequence). The user of this interface has precise control ove
  • SortedSet (java.util)
    SortedSet is a Set which iterates over its elements in a sorted order. The order is determined eithe
  • Project (org.apache.tools.ant)
    Central representation of an Ant project. This class defines an Ant project with all of its targets,
  • Table (org.hibernate.mapping)
    A relational table
  • Best IntelliJ 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