Search in sources :

Example 1 with ClientRegistrationPolicyFactory

use of org.keycloak.services.clientregistration.policy.ClientRegistrationPolicyFactory in project keycloak by keycloak.

the class ClientRegistrationPolicyResource method getProviders.

/**
 * Base path for retrieve providers with the configProperties properly filled
 *
 * @return
 */
@Path("providers")
@GET
@NoCache
@Produces(MediaType.APPLICATION_JSON)
public Stream<ComponentTypeRepresentation> getProviders() {
    return session.getKeycloakSessionFactory().getProviderFactoriesStream(ClientRegistrationPolicy.class).map((ProviderFactory factory) -> {
        ClientRegistrationPolicyFactory clientRegFactory = (ClientRegistrationPolicyFactory) factory;
        List<ProviderConfigProperty> configProps = clientRegFactory.getConfigProperties(session);
        ComponentTypeRepresentation rep = new ComponentTypeRepresentation();
        rep.setId(clientRegFactory.getId());
        rep.setHelpText(clientRegFactory.getHelpText());
        rep.setProperties(ModelToRepresentation.toRepresentation(configProps));
        return rep;
    });
}
Also used : ClientRegistrationPolicy(org.keycloak.services.clientregistration.policy.ClientRegistrationPolicy) ComponentTypeRepresentation(org.keycloak.representations.idm.ComponentTypeRepresentation) ProviderFactory(org.keycloak.provider.ProviderFactory) ProviderConfigProperty(org.keycloak.provider.ProviderConfigProperty) ClientRegistrationPolicyFactory(org.keycloak.services.clientregistration.policy.ClientRegistrationPolicyFactory) Path(javax.ws.rs.Path) Produces(javax.ws.rs.Produces) GET(javax.ws.rs.GET) NoCache(org.jboss.resteasy.annotations.cache.NoCache)

Aggregations

GET (javax.ws.rs.GET)1 Path (javax.ws.rs.Path)1 Produces (javax.ws.rs.Produces)1 NoCache (org.jboss.resteasy.annotations.cache.NoCache)1 ProviderConfigProperty (org.keycloak.provider.ProviderConfigProperty)1 ProviderFactory (org.keycloak.provider.ProviderFactory)1 ComponentTypeRepresentation (org.keycloak.representations.idm.ComponentTypeRepresentation)1 ClientRegistrationPolicy (org.keycloak.services.clientregistration.policy.ClientRegistrationPolicy)1 ClientRegistrationPolicyFactory (org.keycloak.services.clientregistration.policy.ClientRegistrationPolicyFactory)1