Search in sources :

Example 1 with CheckServiceAccessResponse

use of org.platformlayer.auth.model.CheckServiceAccessResponse in project platformlayer by platformlayer.

the class ServicesResource method checkServiceAccess.

@POST
@Path("check")
public CheckServiceAccessResponse checkServiceAccess(CheckServiceAccessRequest request) {
    try {
        requireSystemAccess();
    } catch (AuthenticatorException e) {
        log.warn("Error while checking system token", e);
        throwInternalError();
    }
    ServiceAccountEntity serviceAccount = null;
    try {
        serviceAccount = systemAuthenticator.authenticate(request.chain);
    } catch (AuthenticatorException e) {
        log.warn("Error while authenticating chain", e);
        throwInternalError();
    }
    CheckServiceAccessResponse response = new CheckServiceAccessResponse();
    if (serviceAccount != null) {
        response.serviceAccount = serviceAccount.subject;
    }
    return response;
}
Also used : AuthenticatorException(org.platformlayer.auth.AuthenticatorException) CheckServiceAccessResponse(org.platformlayer.auth.model.CheckServiceAccessResponse) ServiceAccountEntity(org.platformlayer.auth.ServiceAccountEntity) Path(javax.ws.rs.Path) POST(javax.ws.rs.POST)

Aggregations

POST (javax.ws.rs.POST)1 Path (javax.ws.rs.Path)1 AuthenticatorException (org.platformlayer.auth.AuthenticatorException)1 ServiceAccountEntity (org.platformlayer.auth.ServiceAccountEntity)1 CheckServiceAccessResponse (org.platformlayer.auth.model.CheckServiceAccessResponse)1