Package org.beangle.security

Source Code of org.beangle.security.MockAuthenticationManager

/* Copyright c 2005-2012.
* Licensed under GNU  LESSER General Public License, Version 3.
* http://www.gnu.org/licenses
*/
package org.beangle.security;

import org.beangle.security.auth.AbstractAuthenticationManager;
import org.beangle.security.auth.BadCredentialsException;
import org.beangle.security.core.Authentication;
import org.beangle.security.core.AuthenticationException;

public class MockAuthenticationManager extends AbstractAuthenticationManager {

  private boolean grantAccess = true;

  public MockAuthenticationManager(boolean grantAccess) {
    this.grantAccess = grantAccess;
  }

  public MockAuthenticationManager() {
    super();
  }

  public Authentication doAuthentication(Authentication authentication) throws AuthenticationException {
    if (grantAccess) {
      return authentication;
    } else {
      throw new BadCredentialsException("MockAuthenticationManager instructed to deny access");
    }
  }
}
TOP

Related Classes of org.beangle.security.MockAuthenticationManager

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.