use of com.predic8.membrane.core.interceptor.oauth2.authorizationservice.MembraneAuthorizationService in project service-proxy by membrane.
the class OAuth2ResourceTest method getConfiguredOAuth2Resource.
private ServiceProxy getConfiguredOAuth2Resource() {
ServiceProxy sp = new ServiceProxy(new ServiceProxyKey(clientPort), null, 99999);
OAuth2ResourceInterceptor oAuth2ResourceInterceptor = new OAuth2ResourceInterceptor();
MembraneAuthorizationService auth = new MembraneAuthorizationService();
auth.setSrc(getServerAddress());
auth.setClientId("2343243242");
auth.setClientSecret("3423233123123");
auth.setScope("openid profile");
oAuth2ResourceInterceptor.setAuthService(auth);
sp.getInterceptors().add(oAuth2ResourceInterceptor);
sp.getInterceptors().add(new AbstractInterceptor() {
@Override
public Outcome handleRequest(Exchange exc) throws Exception {
OAuth2AnswerParameters answer = OAuth2AnswerParameters.deserialize(String.valueOf(exc.getProperty(Exchange.OAUTH2)));
exc.setResponse(Response.ok(answer.getAccessToken()).build());
return Outcome.RETURN;
}
});
return sp;
}
use of com.predic8.membrane.core.interceptor.oauth2.authorizationservice.MembraneAuthorizationService in project service-proxy by membrane.
the class OAuth2AuthorizationServerInterceptorBase method initMas.
private void initMas() throws Exception {
mas = new MembraneAuthorizationService();
mas.setClientId("abc");
mas.setClientSecret("def");
mas.setSrc(System.getProperty("user.dir") + "\\src\\test\\resources\\oauth2");
mas.init(router);
}
Aggregations