use of org.forgerock.openam.scripting.StandardScriptEngineManager in project OpenAM by OpenRock.
the class ScriptingGuiceModule method configure.
@Override
protected void configure() {
bind(ScriptValidator.class).to(StandardScriptValidator.class);
bind(Logger.class).annotatedWith(Names.named("ScriptLogger")).toInstance(logger);
install(new FactoryModuleBuilder().implement(new TypeLiteral<ScriptingService>() {
}, ScriptConfigurationService.class).build(new TypeLiteral<ScriptingServiceFactory>() {
}));
install(new FactoryModuleBuilder().implement(new TypeLiteral<ScriptingDataStore>() {
}, ScriptConfigurationDataStore.class).build(new TypeLiteral<ScriptingDataStoreFactory>() {
}));
bind(StandardScriptEngineManager.class).annotatedWith(Names.named(AUTHENTICATION_SERVER_SIDE.name())).toInstance(new StandardScriptEngineManager());
bind(StandardScriptEngineManager.class).annotatedWith(Names.named(POLICY_CONDITION.name())).toInstance(new StandardScriptEngineManager());
bind(StandardScriptEngineManager.class).annotatedWith(Names.named(OIDC_CLAIMS.name())).toInstance(new StandardScriptEngineManager());
bind(RestletHttpClient.class).annotatedWith(Names.named(SupportedScriptingLanguage.JAVASCRIPT.name())).to(JavaScriptHttpClient.class);
bind(RestletHttpClient.class).annotatedWith(Names.named(SupportedScriptingLanguage.GROOVY.name())).to(GroovyHttpClient.class);
try {
bind(Client.class).annotatedWith(Names.named("ScriptingHttpClient")).toInstance(new Client(new HttpClientHandler()));
} catch (HttpApplicationException e) {
logger.error("Failed to create HttpClientHandler", e);
}
}
use of org.forgerock.openam.scripting.StandardScriptEngineManager in project OpenAM by OpenRock.
the class OidcClaimsExtensionTest method setupScript.
@BeforeClass
public void setupScript() throws Exception {
String rawScript = IOUtils.readStream(this.getClass().getClassLoader().getResourceAsStream("oidc-claims-extension.groovy"));
SupportedScriptingLanguage scriptType = SupportedScriptingLanguage.GROOVY;
this.script = new ScriptObject("oidc-claims-script", rawScript, scriptType, null);
StandardScriptEngineManager scriptEngineManager = new StandardScriptEngineManager();
scriptEngineManager.registerEngineName(SupportedScriptingLanguage.GROOVY_ENGINE_NAME, new GroovyScriptEngineFactory());
scriptEvaluator = new StandardScriptEvaluator(scriptEngineManager);
}
use of org.forgerock.openam.scripting.StandardScriptEngineManager in project OpenAM by OpenRock.
the class ScriptResourceTest method setUp.
@BeforeMethod
public void setUp() throws ResourceException {
Logger logger = mock(Logger.class);
ScriptingService scriptingService = new MockScriptingService();
ScriptingServiceFactory serviceFactory = mock(ScriptingServiceFactory.class);
when(serviceFactory.create(any(Subject.class), anyString())).thenReturn(scriptingService);
ExceptionMappingHandler<ScriptException, ResourceException> errorHandler = new ScriptExceptionMappingHandler();
scriptResource = new ScriptResource(logger, serviceFactory, errorHandler, new StandardScriptValidator(new StandardScriptEngineManager()));
context = mock(Context.class);
given(context.asContext(HttpContext.class)).willReturn(new HttpContext(json(object(field("headers", Collections.emptyMap()), field("parameters", Collections.emptyMap()))), null));
}
use of org.forgerock.openam.scripting.StandardScriptEngineManager in project OpenAM by OpenRock.
the class ObservedContextFactoryTest method setupTests.
@BeforeMethod
public void setupTests() {
scriptEngineManager = new StandardScriptEngineManager();
testContextFactory = new ObservedContextFactory(scriptEngineManager);
}
Aggregations