Package org.apache.wicket.security.authentication

Examples of org.apache.wicket.security.authentication.LoginException


      }
      else
        subject.addPrincipal(new MyPrincipal("basic"));
      return subject;
    }
    throw new LoginException("Username and password do not match any known user.");
  }
View Full Code Here


      {
        subject.addPrincipal(new SimplePrincipal("admin"));
      }
      return subject;
    }
    throw new LoginException("Username and password do not match any known user.");
  }
View Full Code Here

   */
  @Override
  public Subject login() throws LoginException
  {
    if (token == null)
      throw new LoginException("Insufficient information to login");
    // Attempt authentication.
    try
    {
      AuthenticationManager authenticationManager =
        ((SpringSecureWicketApplication) Application.get()).getAuthenticationManager();
      if (authenticationManager == null)
        throw new LoginException(
          "AuthenticationManager is not available, check if your spring config contains a property for the authenticationManager in your wicketApplication bean.");
      Authentication authResult = authenticationManager.authenticate(token);
      setAuthentication(authResult);
    }

    catch (RuntimeException e)
    {
      setAuthentication(null);
      throw new LoginException(e);
    }
    // cleanup
    token = null;
    // return result
    return new SpringSecureSubject();
View Full Code Here

      }
      else
        subject.addPrincipal(new MyPrincipal("department.rights"));
      return subject;
    }
    throw new LoginException("Username and password do not match any known user.");
  }
View Full Code Here

      // remove basic here.
      subject.addPrincipal(new MyPrincipal("basic"));
      subject.addPrincipal(new MyPrincipal("topsecret"));
      return subject;
    }
    throw new LoginException("username does not match token");
  }
View Full Code Here

      DefaultSubject subject = new MyPrimarySubject();
      // add principals as required, usually these come from a db
      subject.addPrincipal(new MyPrincipal("basic"));
      return subject;
    }
    throw new LoginException("username does not match password");
  }
View Full Code Here

    {
      DefaultSubject subject = new DefaultSubject();
      subject.addPrincipal(new MyPrincipal("basic"));
      return subject;
    }
    throw new LoginException("Username and password do not match any known user.");
  }
View Full Code Here

      return false;
    }
    byte[] decoded = Base64.decodeBase64(param.getBytes());
    String[] split = new String(decoded).split(":");
    if (split == null || split.length != 2)
      throw new LoginException("Could not decrypt username / password");
    Object loginContext = getBasicLoginContext(split[0], split[1]);
    Session session = Session.get();
    if (session instanceof WaspSession)
    {
      if (!isAuthenticated())
View Full Code Here

   * @see LoginContext#login()
   */
  public void login(LoginContext context) throws LoginException
  {
    if (preventsLogin != null)
      throw new LoginException("Additional Logins are not allowed");
    if (context == null)
      throw new LoginException("Context is required to login.");
    HashKey key = new HashKey(context);
    if (subjects.containsKey(key))
      throw new LoginException("Already logged in through this context ")
        .setLoginContext(context);
    Subject mySubject;
    mySubject = context.login();
    if (mySubject == null)
      throw new LoginException("Login failed ").setLoginContext(context);
    mySubject.setReadOnly();
    if (key.preventsAdditionalLogins())
      preventsLogin = key;
    subjects.put(key, mySubject);
    logins.add(key);
View Full Code Here

   */
  @Override
  public final Subject login() throws LoginException
  {
    if (username == null || password == null)
      throw new LoginException("Insufficient information to login");
    Subject subject = getSubject(username, password);
    username = null;
    password = null;
    return subject;
  }
View Full Code Here

TOP

Related Classes of org.apache.wicket.security.authentication.LoginException

Copyright © 2018 www.massapicom. 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.