Package org.springframework.security.userdetails

Examples of org.springframework.security.userdetails.UserDetailsService


    if ( isSec != null ) {
      return isSec;
    }

    try {
      UserDetailsService uds = PentahoSystem.get( UserDetailsService.class );
      if ( uds != null ) {
        isSec = true;
      } else {
        isSec = false;
      }
View Full Code Here


*/
public class ChainedUserDetailsServiceTest {
  @Test
  public void testLoadUserByUsername() throws Exception {

    final UserDetailsService mock1 = mock( UserDetailsService.class );
    UserDetails joeDetails = mock( UserDetails.class );
    UserDetails adminDetails = mock( UserDetails.class );
    when( mock1.loadUserByUsername( "joe" ) ).thenReturn( joeDetails );
    final UserDetailsService mock2 = mock( UserDetailsService.class );
    when( mock1.loadUserByUsername( "admin" ) ).thenReturn( adminDetails );

    ChainedUserDetailsService userDetailsService = new ChainedUserDetailsService( Arrays.asList( mock1, mock2 )  );
    final UserDetails joe = userDetailsService.loadUserByUsername( "joe" );
    assertSame( joeDetails, joe );
View Full Code Here

     * Test constructor rejects null JaasAuthenticationProvider.
     */
    @Test(expected = IllegalArgumentException.class)
    public void testConstructorNullJaasAuthenticationProvider()
    {          
        final UserDetailsService uds = context.mock(UserDetailsService.class);
        new JaasAuthenticationProviderWrapper(null, uds);             
    }
View Full Code Here

    @Test
    public void testAuthenticateParentAuthenticateReturnsNull()
    {
        final JaasAuthenticationProvider provider = context.mock(JaasAuthenticationProvider.class);
        final UsernamePasswordAuthenticationToken auth = context.mock(UsernamePasswordAuthenticationToken.class);
        final UserDetailsService uds = context.mock(UserDetailsService.class);
       
        context.checking(new Expectations()
        {
            {
                //start parent class mock
View Full Code Here

    public void testAuthenticate()
    {
        final JaasAuthenticationProvider provider = context.mock(JaasAuthenticationProvider.class);
        final JaasAuthenticationToken token = context.mock(JaasAuthenticationToken.class);
        final UsernamePasswordAuthenticationToken auth = context.mock(UsernamePasswordAuthenticationToken.class);
        final UserDetailsService uds = context.mock(UserDetailsService.class);
        final UserDetails ud = context.mock(UserDetails.class);
       
        context.checking(new Expectations()
        {
            {
View Full Code Here

     */
    @Test
    public void testSupports()
    {
        final JaasAuthenticationProvider provider = context.mock(JaasAuthenticationProvider.class);       
        final UserDetailsService uds = context.mock(UserDetailsService.class);
        final Sequence executeSequence = context.sequence("executeSequence");
       
        context.checking(new Expectations()
        {
            {               
View Full Code Here

    @Test
    public void testAuthenticate()
    {
        final UsernamePasswordAuthenticationToken auth =
            context.mock(UsernamePasswordAuthenticationToken.class);
        final UserDetailsService uds = context.mock(UserDetailsService.class);
        final UserDetails ud = context.mock(UserDetails.class);
        final UserDetailsChecker checker = context.mock(UserDetailsChecker.class);

        context.checking(new Expectations()
        {
View Full Code Here

     * Test for the Supports method.
     */
    @Test
    public void testSuports()
    {
        final UserDetailsService uds = context.mock(UserDetailsService.class);
        final UserDetailsChecker checker = context.mock(UserDetailsChecker.class);

        OpenAccessAuthenticationProvider sut = new OpenAccessAuthenticationProvider(uds, checker);
        assertTrue(sut.supports(null));
    }
View Full Code Here

    @Test(expected = IllegalArgumentException.class)
    public void testConstructorNullKey()
    {
        final PersistentLoginRepository loginRepo = context
                .mock(PersistentLoginRepository.class);
        final UserDetailsService userDetailsService = context
                .mock(UserDetailsService.class);
        new PersistentLoginService(null, userDetailsService, loginRepo);
    }
View Full Code Here

     * Test constructor rejects null PersistentLoginRepository.
     */
    @Test(expected = IllegalArgumentException.class)
    public void testConstructorNullPersistentLoginRepository()
    {
        final UserDetailsService userDetailsService = context
                .mock(UserDetailsService.class);
        new PersistentLoginService("blah", userDetailsService, null);
    }
View Full Code Here

TOP

Related Classes of org.springframework.security.userdetails.UserDetailsService

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.