Examples of authenticate()


Examples of org.simplecart.security.AdministrationSecurityService.authenticate()

        SecurityService securityService = new AdministrationSecurityService ();
        Administrator administrator = null;

        // perform authentication
        try {
            administrator = (Administrator) securityService.authenticate(username, password);
        } catch (AuthenticationException e) {
            if (e.getMessage().equals("Error initializing dao"))
                errors.add(
                        ActionMessages.GLOBAL_MESSAGE,
                        new ActionMessage("error.database"));
View Full Code Here

Examples of org.simplecart.security.CustomerSecurityService.authenticate()

        SecurityService securityService = new CustomerSecurityService();
        Customer customer = null;

        // perform authentication
        try {
            customer = (Customer) securityService.authenticate(username, password);
        } catch (AuthenticationException e) {
            if (e.getMessage().equals("Error initializing dao"))
                errors.add(
                        ActionMessages.GLOBAL_MESSAGE,
                        new ActionMessage("error.database"));
View Full Code Here

Examples of org.simplecart.security.SecurityService.authenticate()

        SecurityService securityService = new CustomerSecurityService();
        Customer customer = null;

        // perform authentication
        try {
            customer = (Customer) securityService.authenticate(username, password);
        } catch (AuthenticationException e) {
            if (e.getMessage().equals("Error initializing dao"))
                errors.add(
                        ActionMessages.GLOBAL_MESSAGE,
                        new ActionMessage("error.database"));
View Full Code Here

Examples of org.sonatype.security.SecuritySystem.authenticate()

  public void testValidAuthentication()
      throws Exception
  {
    SecuritySystem plexusSecurity = this.lookup(SecuritySystem.class);
    AuthenticationToken token = new UsernamePasswordToken("admin-simple", "admin123");
    AuthenticationInfo authInfo = plexusSecurity.authenticate(token);

    // check
    Assert.assertNotNull(authInfo);
  }
View Full Code Here

Examples of org.springframework.ldap.core.LdapTemplate.authenticate()

            e.printStackTrace();
        }

        LdapTemplate template = new LdapTemplate(source);
        try {
            template.authenticate(DistinguishedName.EMPTY_PATH,
                    new EqualsFilter(configurationModel.getLdapConfiguration()
                            .getLdapUserId(), "test").toString(), "test");
            messages.showMessage(Level.INFO,
                    _("LDAP connection was successful"));
        } catch (Exception e) {
View Full Code Here

Examples of org.springframework.security.AuthenticationManager.authenticate()

        filter.setUserService(userService);
        filter.setAuthenticationManager(authenticationManager);
        filter.afterPropertiesSet();

        when(authenticationManager.authenticate(isA(GaeUserAuthenticationToken.class))).thenAnswer(new AuthenticationAnswer());
        when(userService.isUserLoggedIn()).thenReturn(false);     // user is not logged in

        GaeUser gaeUser = callDoFilter(filter)// no client roles
        assertEquals("", gaeUser.getAuthDomain());
        assertEquals("", gaeUser.getFederatedIdentity());
View Full Code Here

Examples of org.springframework.security.authentication.AnonymousAuthenticationProvider.authenticate()

        AnonymousAuthenticationToken token = new AnonymousAuthenticationToken("WRONG_KEY", "Test",
                AuthorityUtils.createAuthorityList("ROLE_ONE", "ROLE_TWO"));

        try {
            aap.authenticate(token);
            fail("Should have thrown BadCredentialsException");
        } catch (BadCredentialsException expected) {
        }
    }
View Full Code Here

Examples of org.springframework.security.authentication.AuthenticationManager.authenticate()

    @Test
    public void testDoFilterAuthenticateAll() throws Exception {
        AuthenticationSuccessHandler successHandler = mock(AuthenticationSuccessHandler.class);
        AuthenticationManager manager = mock(AuthenticationManager.class);
        Authentication authentication = new TestingAuthenticationToken("un", "pwd","ROLE_USER");
        when(manager.authenticate(any(Authentication.class))).thenReturn(authentication);
        ServiceProperties serviceProperties = new ServiceProperties();
        serviceProperties.setAuthenticateAllArtifacts(true);
        MockHttpServletRequest request = new MockHttpServletRequest();
        request.setParameter("ticket", "ST-1-123");
        request.setRequestURI("/authenticate");
View Full Code Here

Examples of org.springframework.security.authentication.AuthenticationProvider.authenticate()

    @Test
    public void testSuccessfulAuthentication() {
        String[] grants = {"tester", "insight"};
        Authentication token = new TestingAuthenticationToken("testSuccessfulAuthentication", "shir", grants);
        AuthenticationProvider testProvider = new AuthenticationProviderCollectionAspectTestProvider(false);
        Authentication result = testProvider.authenticate(token);
        assertNotNull("No authentication result", result);
        assertSame("Mismatched authentication instances equality", token, result);
        assertOperationResult(result, Arrays.asList(grants));
    }
View Full Code Here

Examples of org.springframework.security.authentication.ProviderManager.authenticate()

        ProviderManager pm = (ProviderManager) appContext.getBeansOfType(ProviderManager.class).values().toArray()[0];
        Object eventPublisher = FieldUtils.getFieldValue(pm, "eventPublisher");
        assertNotNull(eventPublisher);
        assertTrue(eventPublisher instanceof DefaultAuthenticationEventPublisher);

        pm.authenticate(new UsernamePasswordAuthenticationToken("bob", "bobspassword"));
        assertEquals(1, listener.events.size());
    }

    @Test
    public void credentialsAreClearedByDefault() throws Exception {
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.