Tabnine Logo
LoginConfig
Code IndexAdd Tabnine to your IDE (free)

How to use
LoginConfig
in
org.apache.tomcat.util.descriptor.web

Best Java code snippets using org.apache.tomcat.util.descriptor.web.LoginConfig (Showing top 20 results out of 315)

origin: org.ops4j.pax.tipi/org.ops4j.pax.tipi.tomcat-embed-core

/**
 * Construct a new LoginConfig with the specified properties.
 *
 * @param authMethod The authentication method
 * @param realmName The realm name
 * @param loginPage The login page URI
 * @param errorPage The error page URI
 */
public LoginConfig(String authMethod, String realmName,
          String loginPage, String errorPage) {
  super();
  setAuthMethod(authMethod);
  setRealmName(realmName);
  setLoginPage(loginPage);
  setErrorPage(errorPage);
}
origin: OryxProject/oryx

LoginConfig loginConfig = new LoginConfig();
loginConfig.setAuthMethod("DIGEST");
loginConfig.setRealmName(InMemoryRealm.NAME);
context.setLoginConfig(loginConfig);
origin: magro/memcached-session-manager

public boolean contextHasFormBasedSecurityConstraint(){
  if(_contextHasFormBasedSecurityConstraint != null) {
    return _contextHasFormBasedSecurityConstraint.booleanValue();
  }
  final SecurityConstraint[] constraints = getContext().findConstraints();
  final LoginConfig loginConfig = getContext().getLoginConfig();
  _contextHasFormBasedSecurityConstraint = constraints != null && constraints.length > 0
      && loginConfig != null && HttpServletRequest.FORM_AUTH.equals( loginConfig.getAuthMethod() );
  return _contextHasFormBasedSecurityConstraint;
}
origin: org.apache.tomcat/tomcat-catalina

  throw new IllegalArgumentException
    (sm.getString("standardContext.loginConfig.required"));
String loginPage = config.getLoginPage();
if ((loginPage != null) && !loginPage.startsWith("/")) {
  if (isServlet22()) {
      log.debug(sm.getString("standardContext.loginConfig.loginWarning",
             loginPage));
    config.setLoginPage("/" + loginPage);
  } else {
    throw new IllegalArgumentException
String errorPage = config.getErrorPage();
if ((errorPage != null) && !errorPage.startsWith("/")) {
  if (isServlet22()) {
      log.debug(sm.getString("standardContext.loginConfig.errorWarning",
             errorPage));
    config.setErrorPage("/" + errorPage);
  } else {
    throw new IllegalArgumentException
origin: codefollower/Tomcat-Research

sb.append("  <login-config>\n");
appendElement(sb, INDENT4, "auth-method",
    loginConfig.getAuthMethod());
appendElement(sb,INDENT4, "realm-name",
    loginConfig.getRealmName());
if (loginConfig.getErrorPage() != null ||
      loginConfig.getLoginPage() != null) {
  sb.append("    <form-login-config>\n");
  appendElement(sb, INDENT6, "form-login-page",
      loginConfig.getLoginPage());
  appendElement(sb, INDENT6, "form-error-page",
      loginConfig.getErrorPage());
  sb.append("    </form-login-config>\n");
origin: Waffle/waffle

  this.redirectTo(request, response, request.getServletPath());
} else {
  this.redirectTo(request, response, loginConfig.getErrorPage());
this.redirectTo(request, response, loginConfig.getLoginPage());
return false;
origin: jsimone/webapp-runner

static void enableBasicAuth(Context ctx, boolean enableSSL) {
 LoginConfig loginConfig = new LoginConfig();
 loginConfig.setAuthMethod("BASIC");
 ctx.setLoginConfig(loginConfig);
 ctx.addSecurityRole(AUTH_ROLE);
 SecurityConstraint securityConstraint = new SecurityConstraint();
 securityConstraint.addAuthRole(AUTH_ROLE);
 if (enableSSL) {
  securityConstraint.setUserConstraint(TransportGuarantee.CONFIDENTIAL.toString());
 }
 SecurityCollection securityCollection = new SecurityCollection();
 securityCollection.addPattern("/*");
 securityConstraint.addCollection(securityCollection);
 ctx.addConstraint(securityConstraint);
}
origin: org.keycloak/spring-boot-container-bundle

@Override
protected boolean forwardToErrorPageInternal(Request request, HttpServletResponse response, Object loginConfig) throws IOException {
  if (loginConfig == null) return false;
  LoginConfig config = (LoginConfig)loginConfig;
  if (config.getErrorPage() == null) return false;
  // had to do this to get around compiler/IDE issues :(
  try {
    Method method = null;
    /*
    for (Method m : getClass().getDeclaredMethods()) {
      if (m.getName().equals("forwardToErrorPage")) {
        method = m;
        break;
      }
    }
    */
    method = FormAuthenticator.class.getDeclaredMethod("forwardToErrorPage", Request.class, HttpServletResponse.class, LoginConfig.class);
    method.setAccessible(true);
    method.invoke(this, request, response, config);
  } catch (Exception e) {
    throw new RuntimeException(e);
  }
  return true;
}
origin: org.apache.meecrowave/meecrowave-core

public LoginConfigBuilder authMethod(final String authMethod) {
  loginConfig.setAuthMethod(authMethod);
  return this;
}
origin: codefollower/Tomcat-Research

  log.debug(sm.getString("formAuthenticator.forwardLogin",
      request.getRequestURI(), request.getMethod(),
      config.getLoginPage(), context.getName()));
String loginPage = config.getLoginPage();
if (loginPage == null || loginPage.length() == 0) {
  String msg = sm.getString("formAuthenticator.noLoginPage",
origin: codefollower/Tomcat-Research

@Override
public void lifecycleEvent(LifecycleEvent event) {
  try {
    Context context = (Context) event.getLifecycle();
    if (event.getType().equals(Lifecycle.CONFIGURE_START_EVENT)) {
      context.setConfigured(true);
    }
    // LoginConfig is required to process @ServletSecurity
    // annotations
    if (context.getLoginConfig() == null) {
      context.setLoginConfig(
          new LoginConfig("NONE", null, null, null));
      context.getPipeline().addValve(new NonLoginAuthenticator());
    }
  } catch (ClassCastException e) {
    return;
  }
}
origin: org.apache.meecrowave/meecrowave-core

public LoginConfigBuilder loginPage(final String loginPage) {
  loginConfig.setLoginPage(loginPage);
  return this;
}
origin: org.apache.meecrowave/meecrowave-core

public LoginConfigBuilder realmName(final String realmName) {
  loginConfig.setRealmName(realmName);
  return this;
}
origin: org.apache.meecrowave/meecrowave-core

public LoginConfigBuilder errorPage(final String errorPage) {
  loginConfig.setErrorPage(errorPage);
  return this;
}
origin: org.apache.tomcat/tomcat-catalina

protected static String getRealmName(Context context) {
  if (context == null) {
    // Very unlikely
    return REALM_NAME;
  }
  LoginConfig config = context.getLoginConfig();
  if (config == null) {
    return REALM_NAME;
  }
  String result = config.getRealmName();
  if (result == null) {
    return REALM_NAME;
  }
  return result;
}
origin: codefollower/Tomcat-Research

  throw new IllegalArgumentException
    (sm.getString("standardContext.loginConfig.required"));
String loginPage = config.getLoginPage();
if ((loginPage != null) && !loginPage.startsWith("/")) {
  if (isServlet22()) {
      log.debug(sm.getString("standardContext.loginConfig.loginWarning",
             loginPage));
    config.setLoginPage("/" + loginPage);
  } else {
    throw new IllegalArgumentException
String errorPage = config.getErrorPage();
if ((errorPage != null) && !errorPage.startsWith("/")) {
  if (isServlet22()) {
      log.debug(sm.getString("standardContext.loginConfig.errorWarning",
             errorPage));
    config.setErrorPage("/" + errorPage);
  } else {
    throw new IllegalArgumentException
origin: org.apache.tomcat/tomcat-util-scan

sb.append("  <login-config>\n");
appendElement(sb, INDENT4, "auth-method",
    loginConfig.getAuthMethod());
appendElement(sb,INDENT4, "realm-name",
    loginConfig.getRealmName());
if (loginConfig.getErrorPage() != null ||
      loginConfig.getLoginPage() != null) {
  sb.append("    <form-login-config>\n");
  appendElement(sb, INDENT6, "form-login-page",
      loginConfig.getLoginPage());
  appendElement(sb, INDENT6, "form-error-page",
      loginConfig.getErrorPage());
  sb.append("    </form-login-config>\n");
origin: Waffle/waffle

  this.redirectTo(request, response, request.getServletPath());
} else {
  this.redirectTo(request, response, loginConfig.getErrorPage());
this.redirectTo(request, response, loginConfig.getLoginPage());
return false;
origin: com.github.jsimone/webapp-runner-main

static void enableBasicAuth(Context ctx, boolean enableSSL) {
 LoginConfig loginConfig = new LoginConfig();
 loginConfig.setAuthMethod("BASIC");
 ctx.setLoginConfig(loginConfig);
 ctx.addSecurityRole(AUTH_ROLE);
 SecurityConstraint securityConstraint = new SecurityConstraint();
 securityConstraint.addAuthRole(AUTH_ROLE);
 if (enableSSL) {
  securityConstraint.setUserConstraint(TransportGuarantee.CONFIDENTIAL.toString());
 }
 SecurityCollection securityCollection = new SecurityCollection();
 securityCollection.addPattern("/*");
 securityConstraint.addCollection(securityCollection);
 ctx.addConstraint(securityConstraint);
}
origin: org.keycloak/keycloak-saml-tomcat8-adapter

@Override
protected boolean forwardToErrorPageInternal(Request request, HttpServletResponse response, Object loginConfig) throws IOException {
  if (loginConfig == null) return false;
  LoginConfig config = (LoginConfig)loginConfig;
  if (config.getErrorPage() == null) return false;
  // had to do this to get around compiler/IDE issues :(
  try {
    Method method = null;
    /*
    for (Method m : getClass().getDeclaredMethods()) {
      if (m.getName().equals("forwardToErrorPage")) {
        method = m;
        break;
      }
    }
    */
    method = FormAuthenticator.class.getDeclaredMethod("forwardToErrorPage", Request.class, HttpServletResponse.class, LoginConfig.class);
    method.setAccessible(true);
    method.invoke(this, request, response, config);
  } catch (Exception e) {
    throw new RuntimeException(e);
  }
  return true;
}
org.apache.tomcat.util.descriptor.webLoginConfig

Javadoc

Representation of a login configuration element for a web application, as represented in a <login-config> element in the deployment descriptor.

Most used methods

  • getErrorPage
  • getLoginPage
  • setAuthMethod
  • <init>
    Construct a new LoginConfig with the specified properties.
  • getAuthMethod
  • setErrorPage
  • setLoginPage
  • setRealmName
  • getRealmName
  • equals

Popular in Java

  • Running tasks concurrently on multiple threads
  • getOriginalFilename (MultipartFile)
    Return the original filename in the client's filesystem.This may contain path information depending
  • findViewById (Activity)
  • getSystemService (Context)
  • BorderLayout (java.awt)
    A border layout lays out a container, arranging and resizing its components to fit in five regions:
  • BufferedImage (java.awt.image)
    The BufferedImage subclass describes an java.awt.Image with an accessible buffer of image data. All
  • Runnable (java.lang)
    Represents a command that can be executed. Often used to run code in a different Thread.
  • Manifest (java.util.jar)
    The Manifest class is used to obtain attribute information for a JarFile and its entries.
  • BasicDataSource (org.apache.commons.dbcp)
    Basic implementation of javax.sql.DataSource that is configured via JavaBeans properties. This is no
  • FileUtils (org.apache.commons.io)
    General file manipulation utilities. Facilities are provided in the following areas: * writing to a
  • PhpStorm for WordPress
Tabnine Logo
  • Products

    Search for Java codeSearch for JavaScript code
  • IDE Plugins

    IntelliJ IDEAWebStormVisual StudioAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimAtomGoLandRubyMineEmacsJupyter NotebookJupyter LabRiderDataGripAppCode
  • Company

    About UsContact UsCareers
  • Resources

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