Search in sources :

Example 1 with ServerInfoAdminResource

use of org.keycloak.services.resources.admin.info.ServerInfoAdminResource in project keycloak by keycloak.

the class AdminRoot method getServerInfo.

/**
 * General information about the server
 *
 * @param headers
 * @return
 */
@Path("serverinfo")
public Object getServerInfo(@Context final HttpHeaders headers) {
    if (request.getHttpMethod().equals(HttpMethod.OPTIONS)) {
        return new AdminCorsPreflightService(request);
    }
    AdminAuth auth = authenticateRealmAdminRequest(headers);
    if (!AdminPermissions.realms(session, auth).isAdmin()) {
        throw new ForbiddenException();
    }
    if (auth != null) {
        logger.debug("authenticated admin access for: " + auth.getUser().getUsername());
    }
    Cors.add(request).allowedOrigins(auth.getToken()).allowedMethods("GET", "PUT", "POST", "DELETE").auth().build(response);
    ServerInfoAdminResource adminResource = new ServerInfoAdminResource();
    ResteasyProviderFactory.getInstance().injectProperties(adminResource);
    return adminResource;
}
Also used : ForbiddenException(org.keycloak.services.ForbiddenException) ServerInfoAdminResource(org.keycloak.services.resources.admin.info.ServerInfoAdminResource) Path(javax.ws.rs.Path)

Aggregations

Path (javax.ws.rs.Path)1 ForbiddenException (org.keycloak.services.ForbiddenException)1 ServerInfoAdminResource (org.keycloak.services.resources.admin.info.ServerInfoAdminResource)1