Examples of LoginException


Examples of javax.jcr.LoginException

     */
    public final Session loginService(String subServiceName, String workspace) throws LoginException,
            RepositoryException {
        log(LogService.LOG_ERROR,
            "loginService: Cannot get using Bundle because this SlingRepository service is not a ServiceFactory");
        throw new LoginException();
    }
View Full Code Here

Examples of javax.jcr.LoginException

     */
    final Session loginService(final Bundle usingBundle, final String subServiceName, final String workspace)
            throws LoginException, RepositoryException {
        final String userName = this.serviceUserMapper.getServiceUserID(usingBundle, subServiceName);
        if (userName == null) {
            throw new LoginException("Cannot derive user name for bundle "
                + usingBundle + " and sub service " + subServiceName);
        }
        final SimpleCredentials creds = new SimpleCredentials(userName, new char[0]);

        Session admin = null;
View Full Code Here

Examples of javax.jcr.LoginException

      else if (credentials instanceof SimpleCredentials)
      {
         name = ((SimpleCredentials)credentials).getUserID();
      }
      else
         throw new LoginException(
            "Credentials for the authentication should be CredentialsImpl or SimpleCredentials type");

      SessionFactory sessionFactory = (SessionFactory)container.getComponentInstanceOfType(SessionFactory.class);

      ConversationState newState =
View Full Code Here

Examples of javax.security.auth.login.LoginException

          this.securitydomain = domain;    
          this.loginContext = createLoginContext(domain, existing);
          return;
            }
            }
            throw new LoginException(RuntimePlugin.Util.getString("no_passthrough_identity_found")); //$NON-NLS-1$
      }

       
        // If username specifies a domain (user@domain) only that domain is authenticated against.
        // If username specifies no domain, then all domains are tried in order.
        for (String domain:getDomainsForUser(domains, username)) {
                   
            try {
            CallbackHandler handler = new CallbackHandler() {
          @Override
          public void handle(Callback[] callbacks) throws IOException, UnsupportedCallbackException {
            for (int i = 0; i < callbacks.length; i++) {
              if (callbacks[i] instanceof NameCallback) {
                NameCallback nc = (NameCallback)callbacks[i];
                nc.setName(baseUsername);
              } else if (callbacks[i] instanceof PasswordCallback) {
                PasswordCallback pc = (PasswordCallback)callbacks[i];
                    char[] password = null;
                    if (credential != null) {
                      password = credential.getCredentialsAsCharArray();
                    }
                pc.setPassword(password);
                credentials = password;
              } else {
                throw new UnsupportedCallbackException(callbacks[i], "Unrecognized Callback"); //$NON-NLS-1$
              }
            }
          }
            };       
             
            // this is the configured login for teiid
            this.loginContext = createLoginContext(domain,handler);
        this.loginContext.login();
        this.userName = baseUsername+AT+domain;
        this.securitydomain = domain;
        LogManager.logDetail(LogConstants.CTX_SECURITY, new Object[] {"Logon successful for \"", username, "\""}); //$NON-NLS-1$ //$NON-NLS-2$
        return;
      } catch (LoginException e) {
        LogManager.logDetail(LogConstants.CTX_SECURITY,e, e.getMessage());
      }
        }
        throw new LoginException(RuntimePlugin.Util.getString("SessionServiceImpl.The_username_0_and/or_password_are_incorrect", username )); //$NON-NLS-1$      
    }
View Full Code Here

Examples of javax.security.auth.login.LoginException

  }

  public boolean login() throws LoginException {

    if (credentialMap == null) {
      throw new LoginException"Credential Map properties file failed to load"); //$NON-NLS-1$
    }
       
    return super.login();
  }
View Full Code Here

Examples of javax.security.auth.login.LoginException

        cred.setManagedConnectionFactory(getMcf());
        SecurityActions.addCredentials(this.subject, cred);   
      }
      return super.commit();
    } catch (Exception e) {
      throw new LoginException("Failed to decode password: "+e.getMessage()); //$NON-NLS-1$
    }
  } 
View Full Code Here

Examples of javax.security.auth.login.LoginException

         }
         return true;
      }
      catch (Exception e)
      {
         LoginException le = new LoginException();
         le.initCause(e);
         throw le;
      }
   }
View Full Code Here

Examples of javax.security.auth.login.LoginException

   * @see javax.security.auth.spi.LoginModule#login()
   */
  public boolean login() throws LoginException {
    logger.debug("logging in");
    if (callbackHandler == null)
      throw new LoginException(
        "Error: no CallbackHandler available "
          + "to garner authentication information from the user");
    // Setup default callback handlers.
    Callback[] callbacks =
      new Callback[] {
        new NameCallback("Username: "),
        new PasswordCallback("Password: ", false)};

    try {
      callbackHandler.handle(callbacks);
    } catch (IOException e) {
      throw new LoginException("exception calling back: " + e.toString());
    } catch (UnsupportedCallbackException e) {
      throw new LoginException("exception calling back: " + e.toString());
    }

    String username = ((NameCallback) callbacks[0]).getName();
    String password =
      new String(((PasswordCallback) callbacks[1]).getPassword());
    if (username.equals("")) {
      //succesfull login of anoynmous user
      success = true;
      tempPrincipals.add(anonymousUserPrincipal);
      return true;
    }
    //get userInfo and check pwd
    try {
      Resource userResource = getUserResource(username);
      if (userResource == null) {
        if (logger.isInfoEnabled()) {
          logger.info("No user-resource with shortname "+username+" found");
        }
        throw new LoginException("Authentication failed: Password does not match");
      }
      success =
        userResource
          .getProperty(ACCOUNTMANAGER.passwordSha1)
          .getLiteral()
          .getString()
          .equals(
          Util.sha1(password));

      if (!success)
        throw new LoginException("Authentication failed: Password does not match");
      GVSPrincipal newPrincipal = new GVSPrincipal(username, userResource);
      tempPrincipals.add(newPrincipal);
    } catch (RuntimeException ex) {
      logger.error("error handling user info", ex);
      throw ex;
View Full Code Here

Examples of javax.security.auth.login.LoginException

   */
  public boolean commit() throws LoginException {
    logger.debug("committing");
    if (success) {
      if (subject.isReadOnly()) {
        throw new LoginException("Subject is Readonly");
      }
      subject.getPrincipals().addAll(tempPrincipals);
      subject.getPublicCredentials().addAll(tempCredentials);
      tempPrincipals.clear();
      tempCredentials.clear();
View Full Code Here

Examples of javax.security.auth.login.LoginException

  public boolean login() throws LoginException {
    this.client = new JRestClient();
    // 提示输入用户名和密码;
    if (callbackHandler == null) {
      throw new LoginException("没有指明 CallBackHandler!");
    }
    Callback[] callbacks = new Callback[2];
    callbacks[0] = new NameCallback("用户名");
    callbacks[1] = new PasswordCallback("密码", false);
    try {
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.