use of org.jboss.resteasy.annotations.cache.NoCache in project keycloak by keycloak.
the class IdentityProviderResource method getMapperTypes.
/**
* Get mapper types for identity provider
*/
@GET
@Path("mapper-types")
@NoCache
public Map<String, IdentityProviderMapperTypeRepresentation> getMapperTypes() {
this.auth.realm().requireViewIdentityProviders();
if (identityProviderModel == null) {
throw new javax.ws.rs.NotFoundException();
}
KeycloakSessionFactory sessionFactory = session.getKeycloakSessionFactory();
return sessionFactory.getProviderFactoriesStream(IdentityProviderMapper.class).map(IdentityProviderMapper.class::cast).map(mapper -> Arrays.stream(mapper.getCompatibleProviders()).filter(type -> Objects.equals(IdentityProviderMapper.ANY_PROVIDER, type) || Objects.equals(identityProviderModel.getProviderId(), type)).map(type -> {
IdentityProviderMapperTypeRepresentation rep = new IdentityProviderMapperTypeRepresentation();
rep.setId(mapper.getId());
rep.setCategory(mapper.getDisplayCategory());
rep.setName(mapper.getDisplayType());
rep.setHelpText(mapper.getHelpText());
rep.setProperties(mapper.getConfigProperties().stream().map(ModelToRepresentation::toRepresentation).collect(Collectors.toList()));
return rep;
}).findFirst().orElse(null)).filter(Objects::nonNull).collect(Collectors.toMap(IdentityProviderMapperTypeRepresentation::getId, Function.identity()));
}
use of org.jboss.resteasy.annotations.cache.NoCache in project keycloak by keycloak.
the class IdentityProviderResource method setManagementPermissionsEnabled.
/**
* Return object stating whether client Authorization permissions have been initialized or not and a reference
*
* @return initialized manage permissions reference
*/
@Path("management/permissions")
@PUT
@Produces(MediaType.APPLICATION_JSON)
@Consumes(MediaType.APPLICATION_JSON)
@NoCache
public ManagementPermissionReference setManagementPermissionsEnabled(ManagementPermissionReference ref) {
this.auth.realm().requireManageIdentityProviders();
AdminPermissionManagement permissions = AdminPermissions.management(session, realm);
permissions.idps().setPermissionsEnabled(identityProviderModel, ref.isEnabled());
if (ref.isEnabled()) {
return toMgmtRef(identityProviderModel, permissions);
} else {
return new ManagementPermissionReference();
}
}
use of org.jboss.resteasy.annotations.cache.NoCache in project keycloak by keycloak.
the class KeyResource method getKeyMetadata.
@GET
@NoCache
@Produces(MediaType.APPLICATION_JSON)
public KeysMetadataRepresentation getKeyMetadata() {
auth.realm().requireViewRealm();
KeysMetadataRepresentation keys = new KeysMetadataRepresentation();
keys.setActive(new HashMap<>());
List<KeysMetadataRepresentation.KeyMetadataRepresentation> realmKeys = session.keys().getKeysStream(realm).map(key -> {
if (key.getStatus().isActive()) {
if (!keys.getActive().containsKey(key.getAlgorithmOrDefault())) {
keys.getActive().put(key.getAlgorithmOrDefault(), key.getKid());
}
}
return toKeyMetadataRepresentation(key);
}).collect(Collectors.toList());
keys.setKeys(realmKeys);
return keys;
}
use of org.jboss.resteasy.annotations.cache.NoCache in project keycloak by keycloak.
the class RealmAdminResource method getUserMgmtPermissions.
@NoCache
@GET
@Produces(MediaType.APPLICATION_JSON)
@Path("users-management-permissions")
public ManagementPermissionReference getUserMgmtPermissions() {
auth.realm().requireViewRealm();
AdminPermissionManagement permissions = AdminPermissions.management(session, realm);
if (permissions.users().isPermissionsEnabled()) {
return toUsersMgmtRef(permissions);
} else {
return new ManagementPermissionReference();
}
}
use of org.jboss.resteasy.annotations.cache.NoCache in project keycloak by keycloak.
the class RealmAdminResource method testLDAPConnection.
/**
* Test LDAP connection
*
* @param action
* @param connectionUrl
* @param bindDn
* @param bindCredential
* @return
*/
@Path("testLDAPConnection")
@POST
@NoCache
@Consumes(MediaType.APPLICATION_FORM_URLENCODED)
@Deprecated
public Response testLDAPConnection(@FormParam("action") String action, @FormParam("connectionUrl") String connectionUrl, @FormParam("bindDn") String bindDn, @FormParam("bindCredential") String bindCredential, @FormParam("useTruststoreSpi") String useTruststoreSpi, @FormParam("connectionTimeout") String connectionTimeout, @FormParam("componentId") String componentId, @FormParam("startTls") String startTls) {
auth.realm().requireManageRealm();
TestLdapConnectionRepresentation config = new TestLdapConnectionRepresentation(action, connectionUrl, bindDn, bindCredential, useTruststoreSpi, connectionTimeout, startTls, LDAPConstants.AUTH_TYPE_SIMPLE);
config.setComponentId(componentId);
boolean result = LDAPServerCapabilitiesManager.testLDAP(config, session, realm);
return result ? Response.noContent().build() : ErrorResponse.error("LDAP test error", Response.Status.BAD_REQUEST);
}
Aggregations