Search in sources :

Example 1 with UmaProviderSettings

use of org.forgerock.openam.uma.UmaProviderSettings in project OpenAM by OpenRock.

the class UmaEnabledFilterTest method setupFactories.

@BeforeClass
public static void setupFactories() throws Exception {
    notYetConfiguredFactory = mock(UmaProviderSettingsFactory.class);
    given(notYetConfiguredFactory.get(anyString())).willThrow(NotFoundException.class);
    UmaProviderSettings notEnabled = mock(UmaProviderSettings.class);
    given(notEnabled.isEnabled()).willReturn(false);
    notEnabledFactory = mock(UmaProviderSettingsFactory.class);
    given(notEnabledFactory.get(anyString())).willReturn(notEnabled);
    UmaProviderSettings enabled = mock(UmaProviderSettings.class);
    given(enabled.isEnabled()).willReturn(true);
    enabledFactory = mock(UmaProviderSettingsFactory.class);
    given(enabledFactory.get(anyString())).willReturn(enabled);
}
Also used : UmaProviderSettings(org.forgerock.openam.uma.UmaProviderSettings) UmaProviderSettingsFactory(org.forgerock.openam.uma.UmaProviderSettingsFactory) BeforeClass(org.testng.annotations.BeforeClass)

Example 2 with UmaProviderSettings

use of org.forgerock.openam.uma.UmaProviderSettings in project OpenAM by OpenRock.

the class UmaEnabledFilter method enabled.

private Promise<Void, ResourceException> enabled(Context serverContext) {
    try {
        String realm = RealmContext.getRealm(serverContext);
        UmaProviderSettings settings = umaProviderSettingsFactory.get(realm);
        if (settings.isEnabled()) {
            return newResultPromise(null);
        }
    } catch (NotFoundException ignore) {
    }
    return new NotSupportedException("UMA is not currently supported in this realm").asPromise();
}
Also used : UmaProviderSettings(org.forgerock.openam.uma.UmaProviderSettings) NotFoundException(org.forgerock.oauth2.core.exceptions.NotFoundException) NotSupportedException(org.forgerock.json.resource.NotSupportedException)

Example 3 with UmaProviderSettings

use of org.forgerock.openam.uma.UmaProviderSettings in project OpenAM by OpenRock.

the class ResourceSetServiceTest method setup.

@BeforeMethod
public void setup() throws Exception {
    ResourceSetStoreFactory resourceSetStoreFactory = mock(ResourceSetStoreFactory.class);
    resourceSetStore = mock(ResourceSetStore.class);
    policyService = mock(UmaPolicyService.class);
    coreWrapper = mock(CoreWrapper.class);
    UmaProviderSettingsFactory umaProviderSettingsFactory = mock(UmaProviderSettingsFactory.class);
    umaProviderSettings = mock(UmaProviderSettings.class);
    service = new ResourceSetService(resourceSetStoreFactory, policyService, coreWrapper, umaProviderSettingsFactory);
    given(resourceSetStoreFactory.create("REALM")).willReturn(resourceSetStore);
    given(umaProviderSettingsFactory.get("REALM")).willReturn(umaProviderSettings);
}
Also used : CoreWrapper(org.forgerock.openam.core.CoreWrapper) UmaPolicyService(org.forgerock.openam.uma.UmaPolicyService) UmaProviderSettings(org.forgerock.openam.uma.UmaProviderSettings) ResourceSetStore(org.forgerock.oauth2.resources.ResourceSetStore) UmaProviderSettingsFactory(org.forgerock.openam.uma.UmaProviderSettingsFactory) ResourceSetStoreFactory(org.forgerock.openam.oauth2.resources.ResourceSetStoreFactory) BeforeMethod(org.testng.annotations.BeforeMethod)

Aggregations

UmaProviderSettings (org.forgerock.openam.uma.UmaProviderSettings)3 UmaProviderSettingsFactory (org.forgerock.openam.uma.UmaProviderSettingsFactory)2 NotSupportedException (org.forgerock.json.resource.NotSupportedException)1 NotFoundException (org.forgerock.oauth2.core.exceptions.NotFoundException)1 ResourceSetStore (org.forgerock.oauth2.resources.ResourceSetStore)1 CoreWrapper (org.forgerock.openam.core.CoreWrapper)1 ResourceSetStoreFactory (org.forgerock.openam.oauth2.resources.ResourceSetStoreFactory)1 UmaPolicyService (org.forgerock.openam.uma.UmaPolicyService)1 BeforeClass (org.testng.annotations.BeforeClass)1 BeforeMethod (org.testng.annotations.BeforeMethod)1