Examples of AuthenticationManager


Examples of ch.ethz.ssh2.auth.AuthenticationManager

    if (authenticated)
      throw new IllegalStateException("Connection is already authenticated!");

    if (am == null)
      am = new AuthenticationManager(tm);

    if (cm == null)
      cm = new ChannelManager(tm);

    if (user == null)
View Full Code Here

Examples of com.ecyrd.jspwiki.auth.AuthenticationManager

    public final int doWikiStartTag()
        throws IOException
    {
        WikiSession session = m_wikiContext.getWikiSession();
        String status = session.getStatus();
        AuthenticationManager mgr = m_wikiContext.getEngine().getAuthenticationManager();
        boolean containerAuth = mgr.isContainerAuthenticated();
        boolean cookieAssertions = mgr.allowsCookieAssertions();

        if( m_status != null )
        {
            if ( ANONYMOUS.equals( m_status ))
            {
View Full Code Here

Examples of com.gitblit.manager.AuthenticationManager

    }

    IAuthenticationManager newAuthenticationManager() {
      RuntimeManager runtime = new RuntimeManager(getSettings(), GitBlitSuite.BASEFOLDER).start();
      users = new UserManager(runtime).start();
      AuthenticationManager auth = new AuthenticationManager(runtime, users).start();
      return auth;
    }
View Full Code Here

Examples of com.github.ebnew.ki4so.core.authentication.AuthenticationManager

   
   
    //测试认证失败的情况。
    Credential credential = Mockito.mock(Credential.class);
    //当调用认证方法则抛出异常信息。模拟测试数据。
    AuthenticationManager authenticationManager = Mockito.mock(AuthenticationManager.class);
    this.ki4soService.setAuthenticationManager(authenticationManager);
    InvalidCredentialException exception = Mockito.mock(InvalidCredentialException.class);
    String code = "message code";
    String msgKey ="message key";
    Mockito.when(exception.getCode()).thenReturn(code);
    Mockito.when(exception.getMsgKey()).thenReturn(msgKey);
    Mockito.when(authenticationManager.authenticate(credential)).thenThrow(exception);
    LoginResult loginResult = ki4soService.login(credential);
    LoginResult expected = new LoginResult();
    expected.setSuccess(false);
    expected.setCode(code);
    expected.setMsgKey(msgKey);
    //比较结果。
    this.assertLoginResult(expected, loginResult);
   
    //测试认证成功。
    credential = Mockito.mock(Credential.class);
    //当调用认证方法则抛出异常信息。模拟测试数据。
    authenticationManager = Mockito.mock(AuthenticationManager.class);
    this.ki4soService.setAuthenticationManager(authenticationManager);
   
   
    Authentication authentication = Mockito.mock(Authentication.class);
    Mockito.when(exception.getCode()).thenReturn(msgKey);
    Mockito.when(exception.getCode()).thenReturn(code);
    Mockito.when(authenticationManager.authenticate(credential)).thenReturn(authentication);
    loginResult = ki4soService.login(credential);
    expected = new LoginResult();
    expected.setSuccess(true);
    expected.setAuthentication(authentication);
    //比较结果。
View Full Code Here

Examples of com.google.enterprise.connector.spi.AuthenticationManager

   *
   * @throws RepositoryException
   */
  public void testInvalidUser() throws RepositoryException {
    Session session = connector.login();
    AuthenticationManager manager = session.getAuthenticationManager();
    AuthenticationResponse response = manager.authenticate(
        new SimpleAuthenticationIdentity("not a real username"));
    assertFalse(response.isValid());
  }
View Full Code Here

Examples of com.google.enterprise.connector.spi.AuthenticationManager

   *
   * @throws RepositoryException
   */
  public void testValidUser() throws RepositoryException {
    Session session = connector.login();
    AuthenticationManager manager = session.getAuthenticationManager();
    AuthenticationResponse response = manager.authenticate(
        new SimpleAuthenticationIdentity(username, password));
    assertTrue("Failed to authenticate: " + username, response.isValid());
    @SuppressWarnings({ "unchecked", "cast" })
        Collection<Principal> groups = (Collection<Principal>) response.getGroups();
    if (groups != null) {
View Full Code Here

Examples of com.google.enterprise.connector.spi.AuthenticationManager

   *
   * @throws RepositoryException
   */
  public void testValidUserGroupResolutionOnly() throws RepositoryException {
    Session session = connector.login();
    AuthenticationManager manager = session.getAuthenticationManager();
    AuthenticationResponse response = manager.authenticate(
        new SimpleAuthenticationIdentity(username, null));
    assertTrue("Authenticated: " + username, response.isValid());
    @SuppressWarnings({ "unchecked", "cast" })
        Collection<Principal> groups = (Collection<Principal>) response.getGroups();
    if (groups != null) {
View Full Code Here

Examples of com.trilead.ssh2.auth.AuthenticationManager

    if (authenticated)
      throw new IllegalStateException("Connection is already authenticated!");

    if (am == null)
      am = new AuthenticationManager(tm);

    if (cm == null)
      cm = new ChannelManager(tm);

    if (user == null)
View Full Code Here

Examples of de.iritgo.aktera.authentication.AuthenticationManager

      try
      {
        req = ModelTools.createModelRequest();

        AuthenticationManager authMgr = (AuthenticationManager) req.getService(AuthenticationManager.ROLE,
                "default");

        authMgr.setUsername(user.getName());
        authMgr.setPassword(event.getPlainPassword());
        authMgr.setDomain("default");

        UserEnvironment userEnvironment = new DefaultUserEnvironment();
        Context context = new DefaultContext();

        ((DefaultContext) context).put(UserEnvironment.CONTEXT_KEY, userEnvironment);
        authMgr.login(userEnvironment);
        keelIritgoAuthMap.put(new Long(user.getUniqueId()), context);
      }
      catch (Exception x)
      {
        x.printStackTrace();
      }
      finally
      {
        ModelTools.releaseModelRequest(req);
      }
    }

    if ((event != null) && (event.isLoggedOut()))
    {
      User user = event.getUser();

      ModelRequest req = null;

      try
      {
        req = ModelTools.createModelRequest();

        AuthenticationManager authMgr = (AuthenticationManager) req.getService(AuthenticationManager.ROLE, "*");

        authMgr.setUsername(user.getName());
        authMgr.setPassword("");
        authMgr.setDomain("default");

        Context c = (Context) keelIritgoAuthMap.get(new Long(user.getUniqueId()));
        UserEnvironment userEnv = (UserEnvironment) c.get(UserEnvironment.CONTEXT_KEY);

        authMgr.logout(userEnv);
        keelIritgoAuthMap.remove(user.getUniqueId());
      }
      catch (Exception x)
      {
      }
View Full Code Here

Examples of org.acegisecurity.AuthenticationManager

*/
public class AuthenticationManagerProxy implements AuthenticationManager {
    private volatile AuthenticationManager delegate;

    public Authentication authenticate(Authentication authentication) throws AuthenticationException {
        AuthenticationManager m = delegate; // fix the reference we are working with

        if(m ==null)
            throw new DisabledException("Authentication service is still not ready yet");
        else
            return m.authenticate(authentication);
    }
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.