use of org.forgerock.authz.filter.crest.api.CrestAuthorizationModule in project OpenAM by OpenRock.
the class CoreRestGuiceModule method configure.
@Override
protected void configure() {
install(new FactoryModuleBuilder().implement(SmsRequestHandler.class, SmsRequestHandler.class).build(SmsRequestHandlerFactory.class));
install(new FactoryModuleBuilder().implement(SmsCollectionProvider.class, SmsCollectionProvider.class).build(SmsCollectionProviderFactory.class));
install(new FactoryModuleBuilder().implement(SmsSingletonProvider.class, SmsSingletonProvider.class).build(SmsSingletonProviderFactory.class));
install(new FactoryModuleBuilder().implement(SmsGlobalSingletonProvider.class, SmsGlobalSingletonProvider.class).build(SmsGlobalSingletonProviderFactory.class));
bind(DebugRecorder.class).to(DefaultDebugRecorder.class);
MapBinder<RouteMatcher<Request>, Handler> chfEndpointHandlers = newMapBinder(binder(), new TypeLiteral<RouteMatcher<Request>>() {
}, new TypeLiteral<Handler>() {
});
chfEndpointHandlers.addBinding(requestUriMatcher(EQUALS, "authenticate")).to(Key.get(Handler.class, Names.named("AuthenticateHandler")));
MapBinder<Component, AbstractHttpAccessAuditFilter> httpAccessAuditFilterMapBinder = newMapBinder(binder(), Component.class, AbstractHttpAccessAuditFilter.class);
httpAccessAuditFilterMapBinder.addBinding(AUTHENTICATION).to(AuthenticationAccessAuditFilter.class);
Multibinder<UiRolePredicate> userUiRolePredicates = Multibinder.newSetBinder(binder(), UiRolePredicate.class);
userUiRolePredicates.addBinding().to(SelfServiceUserUiRolePredicate.class);
userUiRolePredicates.addBinding().to(GlobalAdminUiRolePredicate.class);
userUiRolePredicates.addBinding().to(RealmAdminUiRolePredicate.class);
MapBinder<MatchingResourcePath, CrestAuthorizationModule> smsGlobalAuthzModuleBinder = MapBinder.newMapBinder(binder(), MatchingResourcePath.class, CrestAuthorizationModule.class);
smsGlobalAuthzModuleBinder.addBinding(resourcePath("realms")).to(AnyPrivilegeAuthzModule.class);
smsGlobalAuthzModuleBinder.addBinding(resourcePath("authentication/modules/*")).to(PrivilegeWriteAndAnyPrivilegeReadOnlyAuthzModule.class);
smsGlobalAuthzModuleBinder.addBinding(resourcePath("services/scripting")).to(PrivilegeWriteAndAnyPrivilegeReadOnlyAuthzModule.class);
smsGlobalAuthzModuleBinder.addBinding(resourcePath("services/scripting/contexts")).to(PrivilegeWriteAndAnyPrivilegeReadOnlyAuthzModule.class);
}
use of org.forgerock.authz.filter.crest.api.CrestAuthorizationModule in project OpenAM by OpenRock.
the class SmsRouteTreeLeafTest method setup.
@BeforeClass
public void setup() {
Router router = new Router();
Function<String, Boolean> handlesFunction = new Function<String, Boolean>() {
@Nullable
@Override
public Boolean apply(String serviceName) {
return "SERVICE_NAME".equals(serviceName);
}
};
routeTree = new SmsRouteTreeLeaf(Collections.<MatchingResourcePath, CrestAuthorizationModule>emptyMap(), null, router, handlesFunction, null, resourcePath(""));
}
use of org.forgerock.authz.filter.crest.api.CrestAuthorizationModule in project OpenAM by OpenRock.
the class CoreRestGuiceModule method getSessionResourceAuthzModule.
@Provides
@Inject
public AnyOfAuthzModule getSessionResourceAuthzModule(SSOTokenManager ssoTokenManager, PrivilegeAuthzModule privilegeAuthzModule, AdminOnlyAuthzModule adminOnlyAuthzModule) {
SessionResourceAuthzModule sessionResourceAuthzModule = new SessionResourceAuthzModule(ssoTokenManager);
List<CrestAuthorizationModule> authzList = new ArrayList<>(3);
authzList.add(adminOnlyAuthzModule);
authzList.add(privilegeAuthzModule);
authzList.add(sessionResourceAuthzModule);
return new AnyOfAuthzModule(authzList);
}
Aggregations