use of org.pac4j.oidc.config.OidcConfiguration in project cas by apereo.
the class DefaultDelegatedClientAuthenticationWebflowManagerTests method verifyOidcStoreOperation.
@Test
public void verifyOidcStoreOperation() throws Exception {
val config = new OidcConfiguration();
config.setClientId(UUID.randomUUID().toString());
config.setSecret(UUID.randomUUID().toString());
val client = new OidcClient(config);
client.setConfiguration(config);
val ticket = delegatedClientAuthenticationWebflowManager.store(context, client);
assertNotNull(ticketRegistry.getTicket(ticket.getId()));
val service = delegatedClientAuthenticationWebflowManager.retrieve(requestContext, context, client);
assertNotNull(service);
assertNull(ticketRegistry.getTicket(ticket.getId()));
}
use of org.pac4j.oidc.config.OidcConfiguration in project ddf by codice.
the class OidcHandlerConfigurationImplTest method testCreateOidcConfigurationAzure.
@Test
public void testCreateOidcConfigurationAzure() {
OidcConfiguration oidcConfiguration = handlerConfiguration.createOidcConfiguration("Azure", "master", "https://base/uri");
assertTrue(oidcConfiguration instanceof AzureAdOidcConfiguration);
assertThat(((AzureAdOidcConfiguration) oidcConfiguration).getTenant(), is("master"));
}
use of org.pac4j.oidc.config.OidcConfiguration in project ddf by codice.
the class OidcHandlerConfigurationImplTest method testCreateOidcConfigurationKeycloak.
@Test
public void testCreateOidcConfigurationKeycloak() {
OidcConfiguration oidcConfiguration = handlerConfiguration.createOidcConfiguration("Keycloak", "master", "https://base/uri");
assertTrue(oidcConfiguration instanceof KeycloakOidcConfiguration);
assertThat(((KeycloakOidcConfiguration) oidcConfiguration).getRealm(), is("master"));
assertThat(((KeycloakOidcConfiguration) oidcConfiguration).getBaseUri(), is("https://base/uri"));
}
use of org.pac4j.oidc.config.OidcConfiguration 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