use of io.gravitee.gateway.api.RequestWrapper in project gravitee-access-management by gravitee-io.
the class EnrichProfilePolicyTest method init.
@Before
public void init() {
reset(configuration, executionContext, request, response);
Request request = new RequestWrapper(mock(Request.class)) {
@Override
public MultiValueMap<String, String> parameters() {
LinkedMultiValueMap<String, String> parameters = new LinkedMultiValueMap<>();
parameters.add(REQUEST_PARAM, PARAM_VALUE);
return parameters;
}
};
TemplateEngine tplEngine = new SpelTemplateEngineFactory().templateEngine();
tplEngine.getTemplateContext().setVariable("request", new EvaluableRequest(request));
when(executionContext.getTemplateEngine()).thenReturn(tplEngine);
when(executionContext.getComponent(UserRepository.class)).thenReturn(userRepository);
}
use of io.gravitee.gateway.api.RequestWrapper in project gravitee-access-management by gravitee-io.
the class EnrichAuthFlowPolicyTest method init.
@Before
public void init() {
reset(configuration, executionContext, request, response, authContextRepository);
Request request = new RequestWrapper(mock(Request.class)) {
@Override
public MultiValueMap<String, String> parameters() {
LinkedMultiValueMap<String, String> parameters = new LinkedMultiValueMap<>();
parameters.add(REQUEST_PARAM, PARAM_VALUE);
return parameters;
}
};
TemplateEngine tplEngine = new SpelTemplateEngineFactory().templateEngine();
tplEngine.getTemplateContext().setVariable("request", new EvaluableRequest(request));
when(executionContext.getTemplateEngine()).thenReturn(tplEngine);
when(executionContext.getComponent(AuthenticationFlowContextRepository.class)).thenReturn(this.authContextRepository);
when(environment.getProperty("authenticationFlow.expirationTimeOut", Integer.class, 300)).thenReturn(300);
when(executionContext.getComponent(Environment.class)).thenReturn(environment);
}
Aggregations