use of org.jboss.resteasy.annotations.cache.NoCache in project keycloak by keycloak.
the class ClientResource method getClientSecret.
/**
* Get the client secret
*
* @return
*/
@Path("client-secret")
@GET
@NoCache
@Produces(MediaType.APPLICATION_JSON)
public CredentialRepresentation getClientSecret() {
auth.clients().requireView(client);
logger.debug("getClientSecret");
UserCredentialModel model = UserCredentialModel.secret(client.getSecret());
if (model == null)
throw new NotFoundException("Client does not have a secret");
return ModelToRepresentation.toRepresentation(model);
}
use of org.jboss.resteasy.annotations.cache.NoCache in project keycloak by keycloak.
the class ClientResource method getInstallationProvider.
@GET
@NoCache
@Path("installation/providers/{providerId}")
public Response getInstallationProvider(@PathParam("providerId") String providerId) {
auth.clients().requireView(client);
ClientInstallationProvider provider = session.getProvider(ClientInstallationProvider.class, providerId);
if (provider == null)
throw new NotFoundException("Unknown Provider");
return provider.generateInstallation(session, realm, client, session.getContext().getUri().getBaseUri());
}
use of org.jboss.resteasy.annotations.cache.NoCache in project keycloak by keycloak.
the class RoleContainerResource method setManagementPermissionsEnabled.
/**
* Return object stating whether role Authorization permissions have been initialized or not and a reference
*
* @param roleName
* @return initialized manage permissions reference
*/
@Path("{role-name}/management/permissions")
@PUT
@Produces(MediaType.APPLICATION_JSON)
@Consumes(MediaType.APPLICATION_JSON)
@NoCache
public ManagementPermissionReference setManagementPermissionsEnabled(@PathParam("role-name") final String roleName, ManagementPermissionReference ref) {
auth.roles().requireManage(roleContainer);
RoleModel role = roleContainer.getRole(roleName);
if (role == null) {
throw new NotFoundException("Could not find role");
}
AdminPermissionManagement permissions = AdminPermissions.management(session, realm);
permissions.roles().setPermissionsEnabled(role, ref.isEnabled());
if (ref.isEnabled()) {
return RoleByIdResource.toMgmtRef(role, permissions);
} else {
return new ManagementPermissionReference();
}
}
use of org.jboss.resteasy.annotations.cache.NoCache in project keycloak by keycloak.
the class ClientScopeEvaluateResource method generateExampleAccessToken.
/**
* Create JSON with payload of example access token
*
* @return
*/
@GET
@Path("generate-example-access-token")
@NoCache
@Produces(MediaType.APPLICATION_JSON)
public AccessToken generateExampleAccessToken(@QueryParam("scope") String scopeParam, @QueryParam("userId") String userId) {
auth.clients().requireView(client);
UserModel user = getUserModel(userId);
logger.debugf("generateExampleAccessToken invoked. User: %s, Scope param: %s", user.getUsername(), scopeParam);
return sessionAware(user, scopeParam, (userSession, clientSessionCtx) -> {
TokenManager tokenManager = new TokenManager();
return tokenManager.responseBuilder(realm, client, null, session, userSession, clientSessionCtx).generateAccessToken().getAccessToken();
});
}
use of org.jboss.resteasy.annotations.cache.NoCache in project keycloak by keycloak.
the class ClientScopeEvaluateResource method generateExampleUserinfo.
/**
* Create JSON with payload of example user info
*
* @return
*/
@GET
@Path("generate-example-userinfo")
@NoCache
@Produces(MediaType.APPLICATION_JSON)
public Map<String, Object> generateExampleUserinfo(@QueryParam("scope") String scopeParam, @QueryParam("userId") String userId) {
auth.clients().requireView(client);
UserModel user = getUserModel(userId);
logger.debugf("generateExampleUserinfo invoked. User: %s", user.getUsername());
return sessionAware(user, scopeParam, (userSession, clientSessionCtx) -> {
AccessToken userInfo = new AccessToken();
TokenManager tokenManager = new TokenManager();
tokenManager.transformUserInfoAccessToken(session, userInfo, userSession, clientSessionCtx);
return tokenManager.generateUserInfoClaims(userInfo, user);
});
}
Aggregations