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);
}
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();
}
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);
}
Aggregations