Search in sources :

Example 1 with BooleanUtils

use of org.apache.commons.lang3.BooleanUtils in project cas by apereo.

the class JwtServiceTicketResourceEntityResponseFactory method grantServiceTicket.

@Override
protected String grantServiceTicket(final String ticketGrantingTicket, final WebApplicationService webApplicationService, final AuthenticationResult authenticationResult) {
    val registeredService = this.servicesManager.findServiceBy(webApplicationService);
    LOGGER.debug("Located registered service [{}] for [{}]", registeredService, webApplicationService);
    RegisteredServiceAccessStrategyUtils.ensureServiceAccessIsAllowed(webApplicationService, registeredService);
    val tokenAsResponse = RegisteredServiceProperties.TOKEN_AS_SERVICE_TICKET.isAssignedTo(registeredService, BooleanUtils::toBoolean);
    if (!tokenAsResponse) {
        LOGGER.debug("Service [{}] does not require JWT tickets; properties assigned are [{}]", webApplicationService, registeredService.getProperties());
        return super.grantServiceTicket(ticketGrantingTicket, webApplicationService, authenticationResult);
    }
    val serviceTicket = super.grantServiceTicket(ticketGrantingTicket, webApplicationService, authenticationResult);
    val jwt = tokenTicketBuilder.build(serviceTicket, webApplicationService);
    LOGGER.debug("Generated JWT [{}] for service [{}]", jwt, webApplicationService);
    return jwt;
}
Also used : lombok.val(lombok.val) BooleanUtils(org.apache.commons.lang3.BooleanUtils)

Aggregations

lombok.val (lombok.val)1 BooleanUtils (org.apache.commons.lang3.BooleanUtils)1