Search in sources :

Example 1 with CompositeTokenConfiguration

use of org.apache.jackrabbit.oak.spi.security.authentication.token.CompositeTokenConfiguration in project jackrabbit-oak by apache.

the class SecurityProviderRegistrationTest method testBindUnbindTokenConfiguration.

@Test
public void testBindUnbindTokenConfiguration() throws Exception {
    Field f = registration.getClass().getDeclaredField("tokenConfiguration");
    f.setAccessible(true);
    assertTrue(f.get(registration) instanceof CompositeTokenConfiguration);
    TokenConfiguration tc = mockConfiguration(TokenConfiguration.class);
    registration.bindTokenConfiguration(tc, PROPS);
    CompositeTokenConfiguration composite = (CompositeTokenConfiguration) f.get(registration);
    assertEquals(1, composite.getConfigurations().size());
    assertTrue(composite.getConfigurations().contains(tc));
    registration.unbindTokenConfiguration(tc, PROPS);
    composite = (CompositeTokenConfiguration) f.get(registration);
    assertTrue(composite.getConfigurations().isEmpty());
}
Also used : CompositeTokenConfiguration(org.apache.jackrabbit.oak.spi.security.authentication.token.CompositeTokenConfiguration) TokenConfiguration(org.apache.jackrabbit.oak.spi.security.authentication.token.TokenConfiguration) Field(java.lang.reflect.Field) CompositeTokenConfiguration(org.apache.jackrabbit.oak.spi.security.authentication.token.CompositeTokenConfiguration) AbstractSecurityTest(org.apache.jackrabbit.oak.AbstractSecurityTest) Test(org.junit.Test)

Example 2 with CompositeTokenConfiguration

use of org.apache.jackrabbit.oak.spi.security.authentication.token.CompositeTokenConfiguration in project jackrabbit-oak by apache.

the class TokenLoginModuleCredentialsSupportTest method before.

@Before
public void before() throws Exception {
    super.before();
    userId = getTestUser().getID();
    credentialsSupport = new TestCredentialsSupport(userId);
    CompositeTokenConfiguration composite = ((CompositeTokenConfiguration) getSecurityProvider().getConfiguration(TokenConfiguration.class));
    tc = (TokenConfigurationImpl) composite.getDefaultConfig();
    tc.bindCredentialsSupport(credentialsSupport);
}
Also used : CompositeTokenConfiguration(org.apache.jackrabbit.oak.spi.security.authentication.token.CompositeTokenConfiguration) Before(org.junit.Before)

Example 3 with CompositeTokenConfiguration

use of org.apache.jackrabbit.oak.spi.security.authentication.token.CompositeTokenConfiguration in project jackrabbit-oak by apache.

the class TokenExternalLoginModuleTest method before.

@Before
public void before() throws Exception {
    super.before();
    credentialsSupport = getCredentialsSupport();
    // NOTE: should be replaced by proper OSGi setup
    CompositeTokenConfiguration composite = ((CompositeTokenConfiguration) getSecurityProvider().getConfiguration(TokenConfiguration.class));
    tc = (TokenConfigurationImpl) composite.getDefaultConfig();
    tc.bindCredentialsSupport(credentialsSupport);
}
Also used : CompositeTokenConfiguration(org.apache.jackrabbit.oak.spi.security.authentication.token.CompositeTokenConfiguration) Before(org.junit.Before)

Aggregations

CompositeTokenConfiguration (org.apache.jackrabbit.oak.spi.security.authentication.token.CompositeTokenConfiguration)3 Before (org.junit.Before)2 Field (java.lang.reflect.Field)1 AbstractSecurityTest (org.apache.jackrabbit.oak.AbstractSecurityTest)1 TokenConfiguration (org.apache.jackrabbit.oak.spi.security.authentication.token.TokenConfiguration)1 Test (org.junit.Test)1