use of org.pac4j.core.http.url.DefaultUrlResolver in project pac4j by pac4j.
the class PathParameterCallbackUrlResolverTests method testCompute.
@Test
public void testCompute() {
final String url = resolver.compute(new DefaultUrlResolver(), CALLBACK_URL, CLIENT_NAME, MockWebContext.create());
assertEquals(CALLBACK_URL + "/" + CLIENT_NAME, url);
}
use of org.pac4j.core.http.url.DefaultUrlResolver in project pac4j by pac4j.
the class QueryParameterCallbackUrlResolverTests method testComputeSpecificParameter.
@Test
public void testComputeSpecificParameter() {
final QueryParameterCallbackUrlResolver resolver = new QueryParameterCallbackUrlResolver();
resolver.setClientNameParameter(KEY);
final String url = resolver.compute(new DefaultUrlResolver(), CALLBACK_URL, CLIENT_NAME, MockWebContext.create());
assertEquals(CALLBACK_URL + '?' + KEY + '=' + CLIENT_NAME, url);
}
use of org.pac4j.core.http.url.DefaultUrlResolver in project pac4j by pac4j.
the class QueryParameterCallbackUrlResolverTests method testCompute.
@Test
public void testCompute() {
final String url = resolver.compute(new DefaultUrlResolver(), CALLBACK_URL, CLIENT_NAME, MockWebContext.create());
assertEquals(CALLBACK_URL + '?' + Pac4jConstants.DEFAULT_CLIENT_NAME_PARAMETER + '=' + CLIENT_NAME, url);
}
use of org.pac4j.core.http.url.DefaultUrlResolver in project druid by druid-io.
the class Pac4jAuthenticator method createPac4jConfig.
private Config createPac4jConfig(OIDCConfig oidcConfig) {
OidcConfiguration oidcConf = new OidcConfiguration();
oidcConf.setClientId(oidcConfig.getClientID());
oidcConf.setSecret(oidcConfig.getClientSecret().getPassword());
oidcConf.setDiscoveryURI(oidcConfig.getDiscoveryURI());
oidcConf.setExpireSessionWithToken(true);
oidcConf.setUseNonce(true);
oidcConf.setReadTimeout(Ints.checkedCast(pac4jCommonConfig.getReadTimeout().getMillis()));
oidcConf.setResourceRetriever(// ResourceRetriever is used to get Auth server configuration from "discoveryURI"
new CustomSSLResourceRetriever(pac4jCommonConfig.getReadTimeout().getMillis(), sslSocketFactory));
OidcClient oidcClient = new OidcClient(oidcConf);
oidcClient.setUrlResolver(new DefaultUrlResolver(true));
oidcClient.setCallbackUrlResolver(new NoParameterCallbackUrlResolver());
// This is used by OidcClient in various places to make HTTPrequests.
if (sslSocketFactory != null) {
HTTPRequest.setDefaultSSLSocketFactory(sslSocketFactory);
}
return new Config(Pac4jCallbackResource.SELF_URL, oidcClient);
}
Aggregations