Package javax.security.auth.login

Examples of javax.security.auth.login.Configuration


                        throw new UnsupportedCallbackException(callback, "Unrecognized Callback " + callback);
                    }
                }
            }
        };
        testConfiguration = new Configuration() {
            public void refresh() {
            }

            public AppConfigurationEntry[] getAppConfigurationEntry(String name) {
                return new AppConfigurationEntry[] { new AppConfigurationEntry(TestLoginModule.class.getName(),
View Full Code Here


    private ApplicationEventPublisher publisher;
    private Log log;

    @Before
    public void setUp() throws Exception {
        Configuration configuration = mock(Configuration.class);
        publisher = mock(ApplicationEventPublisher.class);
        log = mock(Log.class);
        provider = new DefaultJaasAuthenticationProvider();
        provider.setConfiguration(configuration);
        provider.setApplicationEventPublisher(publisher);
        provider.setAuthorityGranters(new AuthorityGranter[] { new TestAuthorityGranter() });
        provider.afterPropertiesSet();
        AppConfigurationEntry[] aces = new AppConfigurationEntry[] { new AppConfigurationEntry(
                TestLoginModule.class.getName(), LoginModuleControlFlag.REQUIRED,
                Collections.<String, Object> emptyMap()) };
        when(configuration.getAppConfigurationEntry(provider.getLoginContextName())).thenReturn(aces);
        token = new UsernamePasswordAuthenticationToken("user", "password");
        ReflectionTestUtils.setField(provider, "log", log);

    }
View Full Code Here

*
* @author josephg@gmail.com (Joseph Gentle)
*/
public class AuthTestUtil {
  public static Configuration makeConfiguration() {
    return new Configuration() {
      @Override
      public AppConfigurationEntry[] getAppConfigurationEntry(String name) {
        if (name.equals("Wave")) {
          AppConfigurationEntry entry =
              new AppConfigurationEntry(AccountStoreLoginModule.class.getName(),
View Full Code Here

*/
public class FlagsMeaningTest extends TestCase {
    private static final Map<String, Object> noOptions = Collections.emptyMap();

    public void testSufficientExceptionTrue() throws LoginException {
        Configuration conf = new FixedConfiguration(new AppConfigurationEntry[] {
                new AppConfigurationEntry(ExceptionLM.class.getName(), AppConfigurationEntry.LoginModuleControlFlag.SUFFICIENT, noOptions),
                new AppConfigurationEntry(TrueLM.class.getName(), AppConfigurationEntry.LoginModuleControlFlag.SUFFICIENT, noOptions),
        });
        LoginContext lc = new LoginContext("foo", null, null, conf);
        lc.login();
View Full Code Here

        LoginContext lc = new LoginContext("foo", null, null, conf);
        lc.login();
    }

    public void testSufficientFalseTrue() throws LoginException {
        Configuration conf = new FixedConfiguration(new AppConfigurationEntry[] {
                new AppConfigurationEntry(FalseLM.class.getName(), AppConfigurationEntry.LoginModuleControlFlag.SUFFICIENT, noOptions),
                new AppConfigurationEntry(TrueLM.class.getName(), AppConfigurationEntry.LoginModuleControlFlag.SUFFICIENT, noOptions),
        });
        LoginContext lc = new LoginContext("foo", null, null, conf);
        lc.login();
View Full Code Here

        LoginContext lc = new LoginContext("foo", null, null, conf);
        lc.login();
    }

    public void testSufficientExceptionRequiredTrue() throws LoginException {
        Configuration conf = new FixedConfiguration(new AppConfigurationEntry[] {
                new AppConfigurationEntry(ExceptionLM.class.getName(), AppConfigurationEntry.LoginModuleControlFlag.SUFFICIENT, noOptions),
                new AppConfigurationEntry(TrueLM.class.getName(), AppConfigurationEntry.LoginModuleControlFlag.REQUIRED, noOptions),
        });
        LoginContext lc = new LoginContext("foo", null, null, conf);
        lc.login();
View Full Code Here

        LoginContext lc = new LoginContext("foo", null, null, conf);
        lc.login();
    }

    public void testOptionalExceptionTrue() throws LoginException {
        Configuration conf = new FixedConfiguration(new AppConfigurationEntry[] {
                new AppConfigurationEntry(ExceptionLM.class.getName(), AppConfigurationEntry.LoginModuleControlFlag.OPTIONAL, noOptions),
                new AppConfigurationEntry(TrueLM.class.getName(), AppConfigurationEntry.LoginModuleControlFlag.OPTIONAL, noOptions),
        });
        LoginContext lc = new LoginContext("foo", null, null, conf);
        lc.login();
View Full Code Here

        LoginContext lc = new LoginContext("foo", null, null, conf);
        lc.login();
    }

    public void testOptionalTrueException() throws LoginException {
        Configuration conf = new FixedConfiguration(new AppConfigurationEntry[] {
                new AppConfigurationEntry(TrueLM.class.getName(), AppConfigurationEntry.LoginModuleControlFlag.OPTIONAL, noOptions),
                new AppConfigurationEntry(ExceptionLM.class.getName(), AppConfigurationEntry.LoginModuleControlFlag.OPTIONAL, noOptions),
        });
        LoginContext lc = new LoginContext("foo", null, null, conf);
        lc.login();
View Full Code Here

        LoginContext lc = new LoginContext("foo", null, null, conf);
        lc.login();
    }

    public void testRequiredExceptionTrue() throws LoginException {
        Configuration conf = new FixedConfiguration(new AppConfigurationEntry[] {
                new AppConfigurationEntry(ExceptionLM.class.getName(), AppConfigurationEntry.LoginModuleControlFlag.REQUIRED, noOptions),
                new AppConfigurationEntry(TrueLM.class.getName(), AppConfigurationEntry.LoginModuleControlFlag.REQUIRED, noOptions),
        });
        LoginContext lc = new LoginContext("foo", null, null, conf);
        try {
View Full Code Here

        } catch (LoginException e) {
        }
    }

    public void testRequisiteExceptionTrue() throws LoginException {
        Configuration conf = new FixedConfiguration(new AppConfigurationEntry[] {
                new AppConfigurationEntry(ExceptionLM.class.getName(), AppConfigurationEntry.LoginModuleControlFlag.REQUISITE, noOptions),
                new AppConfigurationEntry(TrueLM.class.getName(), AppConfigurationEntry.LoginModuleControlFlag.REQUISITE, noOptions),
        });
        LoginContext lc = new LoginContext("foo", null, null, conf);
        try {
View Full Code Here

TOP

Related Classes of javax.security.auth.login.Configuration

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.