protected void evaluateProxiedServiceIfNeeded ( final Service service , final TicketGrantingTicket ticketGrantingTicket , final RegisteredService registeredService ) { val proxiedBy = ticketGrantingTicket . getProxiedBy ( ) ; if ( proxiedBy != null ) { LOGGER . debug ( "Ticket-granting ticket is proxied by [{}]. Locating proxy service in registry..." , proxiedBy . getId ( ) ) ; val proxyingService = this . servicesManager . findServiceBy ( proxiedBy ) ; if ( proxyingService != null ) { LOGGER . debug ( "Located proxying service [{}] in the service registry" , proxyingService ) ; if ( ! proxyingService . getProxyPolicy ( ) . isAllowedToProxy ( ) ) { LOGGER . warn ( "Found proxying service [{}], but it is not authorized to fulfill the proxy attempt made by [{}]" , proxyingService . getId ( ) , service . getId ( ) ) ; throw new UnauthorizedProxyingException ( UnauthorizedProxyingException . MESSAGE + registeredService . getId ( ) ) ; } } else { LOGGER . warn ( "No proxying service found. Proxy attempt by service [{}] (registered service [{}]) is not allowed." , service . getId ( ) , registeredService . getId ( ) ) ; throw new UnauthorizedProxyingException ( UnauthorizedProxyingException . MESSAGE + registeredService . getId ( ) ) ; } } else { LOGGER . trace ( "Ticket-granting ticket is not proxied by another service" ) ; } }
Evaluate proxied service if needed .