Examples of LoginConfig


Examples of org.apache.catalina.deploy.LoginConfig

      Request request = (Request) messageInfo.getRequestMessage();
      Response response = (Response) messageInfo.getResponseMessage();
    
      Principal principal;
      context = request.getContext();
      LoginConfig config = context.getLoginConfig();
     
      // Validate any credentials already included with this request
      String username = null;
      String password = null;

      MessageBytes authorization =
          request.getCoyoteRequest().getMimeHeaders()
          .getValue("authorization");
     
      if (authorization != null) {
          authorization.toBytes();
          ByteChunk authorizationBC = authorization.getByteChunk();
          if (authorizationBC.startsWithIgnoreCase("basic ", 0)) {
              authorizationBC.setOffset(authorizationBC.getOffset() + 6);
              // FIXME: Add trimming
              // authorizationBC.trim();
             
              CharChunk authorizationCC = authorization.getCharChunk();
              Base64.decode(authorizationBC, authorizationCC);
             
              // Get username and password
              int colon = authorizationCC.indexOf(':');
              if (colon < 0) {
                  username = authorizationCC.toString();
              } else {
                  char[] buf = authorizationCC.getBuffer();
                  username = new String(buf, 0, colon);
                  password = new String(buf, colon + 1,
                          authorizationCC.getEnd() - colon - 1);
              }
             
              authorizationBC.setOffset(authorizationBC.getOffset() - 6);
          }

          principal = context.getRealm().authenticate(username, password);
          if (principal != null) {
             registerWithCallbackHandler(principal, username, password);
            
              /*register(request, response, principal, Constants.BASIC_METHOD,
                       username, password);*/
             return AuthStatus.SUCCESS;
          }
      }

      // Send an "unauthorized" response and an appropriate challenge
      MessageBytes authenticate =
          response.getCoyoteResponse().getMimeHeaders()
          .addValue(AUTHENTICATE_BYTES, 0, AUTHENTICATE_BYTES.length);
      CharChunk authenticateCC = authenticate.getCharChunk();
      try
      {
         authenticateCC.append("Basic realm=\"");
         if (config.getRealmName() == null) {
            authenticateCC.append(request.getServerName());
            authenticateCC.append(':');
            authenticateCC.append(Integer.toString(request.getServerPort()));
         } else {
            authenticateCC.append(config.getRealmName());
         }
         authenticateCC.append('\"');       
         authenticate.toChars();

         response.sendError(HttpServletResponse.SC_UNAUTHORIZED);
View Full Code Here

Examples of org.apache.geronimo.jee.loginconfig.LoginConfig

  }
  XmlAttributeType xmlAtttribute = new XmlAttributeType();
  xmlAtttribute.setName("LoginModuleConfiguration");
  xmlrefElement.setValue(xmlAtttribute);

  LoginConfig config = new LoginConfig();
  xmlAtttribute.setAny(config);
  LoginModule loginModule = new LoginModule();
  config.getLoginModuleRefOrLoginModule().add(loginModule);
  loginModule.setControlFlag(ControlFlag.fromValue("REQUIRED"));
  loginModule.setWrapPrincipals(false);
  loginModule.setLoginDomainName(realmName);

  String realmType = page0.combo.getText().trim();
View Full Code Here

Examples of org.apache.jmeter.config.LoginConfig

        prop.recoverRunningVersion(null);
        assertEquals("value", prop.getStringValue());
    }

    public void testElementProperty() throws Exception {
        LoginConfig config = new LoginConfig();
        config.setUsername("username");
        config.setPassword("password");
        TestElementProperty prop = new TestElementProperty("name", config);
        prop.setRunningVersion(true);
        config = new LoginConfig();
        config.setUsername("user2");
        config.setPassword("pass2");
        prop.setObjectValue(config);
        assertEquals("user2=pass2", prop.getStringValue());
        prop.recoverRunningVersion(null);
        assertEquals("username=password", prop.getStringValue());
        config = new LoginConfig();
        config.setUsername("user2");
        config.setPassword("pass2");
        prop.setObjectValue(config);
        config = new LoginConfig();
        config.setUsername("user3");
        config.setPassword("pass3");
        prop.setObjectValue(config);
        assertEquals("user3=pass3", prop.getStringValue());
        prop.recoverRunningVersion(null);
        assertEquals("username=password", prop.getStringValue());
    }
View Full Code Here

Examples of org.apache.jmeter.config.LoginConfig

   *
   *@return    Description of the Returned Value
   ***********************************************************/
  public Object clone()
  {
    LoginConfig newConfig = new DbConfig();
    configureClone(newConfig);
    return newConfig;
  }
View Full Code Here

Examples of org.apache.jmeter.config.LoginConfig

        assertEquals("value",prop.getStringValue());       
    }
   
    public void testElementProperty() throws Exception
        {
            LoginConfig config = new LoginConfig();
            config.setUsername("username");
            config.setPassword("password");
            TestElementProperty prop = new TestElementProperty("name",config);
            prop.setRunningVersion(true);
            config = new LoginConfig();
            config.setUsername("user2");
            config.setPassword("pass2");
            prop.setObjectValue(config);
            assertEquals("user2=pass2",prop.getStringValue());
            prop.recoverRunningVersion(null);
            assertEquals("username=password",prop.getStringValue());
            config = new LoginConfig();
            config.setUsername("user2");
            config.setPassword("pass2");
            prop.setObjectValue(config);
            config = new LoginConfig();
            config.setUsername("user3");
            config.setPassword("pass3");
            prop.setObjectValue(config);
            assertEquals("user3=pass3",prop.getStringValue());
            prop.recoverRunningVersion(null);
            assertEquals("username=password",prop.getStringValue());       
        }
View Full Code Here

Examples of org.apache.jmeter.config.LoginConfig

    public void testRecovery() throws Exception
    {
        ConfigTestElement config = new ConfigTestElement();
        config.addProperty(new StringProperty("name","config"));
        config.setRunningVersion(true);
        LoginConfig loginConfig = new LoginConfig();
        loginConfig.setUsername("user1");
        loginConfig.setPassword("pass1");
        assertTrue(config.getProperty("login") instanceof NullProperty);
        // This test should work whether or not all Nulls are equal
        assertEquals(new NullProperty("login"),config.getProperty("login"));
        config.addProperty(new TestElementProperty("login",loginConfig));
        assertEquals(
            loginConfig.toString(),
            config.getPropertyAsString("login"));
        config.recoverRunningVersion();
        assertTrue(config.getProperty("login") instanceof NullProperty);
        assertEquals(new NullProperty("login"),config.getProperty("login"));
    }
View Full Code Here

Examples of org.apache.tomcat.deploy.LoginConfig

     *
     * @param config The new login configuration
     */
    public void setLoginConfig(LoginConfig config) {

  LoginConfig oldLoginConfig = this.loginConfig;
  this.loginConfig = config;
  support.firePropertyChange("loginConfig",
           oldLoginConfig, this.loginConfig);

    }
View Full Code Here

Examples of org.apache.tomcat.util.descriptor.web.LoginConfig

        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;
View Full Code Here

Examples of org.apache.tomcat.util.descriptor.web.LoginConfig

                                  errorPage));
            }
        }

        // Process the property setting change
        LoginConfig oldLoginConfig = this.loginConfig;
        this.loginConfig = config;
        support.firePropertyChange("loginConfig",
                                   oldLoginConfig, this.loginConfig);

    }
View Full Code Here

Examples of org.apache.tomcat.util.descriptor.web.LoginConfig

        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;
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.