Gets token ticket cipher executor for service.

@param registeredService the registered service
@return the token ticket cipher executor for service
547272
public JwtTicketCipherExecutor getTokenTicketCipherExecutorForService(final RegisteredService registeredService) {
        val encryptionKey = getEncryptionKey(registeredService).orElse(StringUtils.EMPTY);
        val signingKey = getSigningKey(registeredService).orElse(StringUtils.EMPTY);
        return new JwtTicketCipherExecutor(encryptionKey, signingKey,
            StringUtils.isNotBlank(encryptionKey), StringUtils.isNotBlank(signingKey), 0, 0);
    }
645126
public static void putRegisteredService(final RequestContext context, final RegisteredService registeredService) {
        context.getFlowScope().put(PARAMETER_REGISTERED_SERVICE, registeredService);
    }
626092
public TProcessorFactory getAuthProcFactory(ThriftCLIService service) throws LoginException {
    if (authTypeStr.equalsIgnoreCase(AuthTypes.KERBEROS.getAuthName())) {
      return KerberosSaslHelper.getKerberosProcessorFactory(saslServer, service);
    } else {
      return PlainSaslHelper.getPlainProcessorFactory(service);
    }
  }
661330
protected synchronized ExecutorService getService()
    {
        if (service == null)
        {
            // System.out.println("creating an executor service with a threadpool of size " + threadPoolSize);
            service = Executors.newFixedThreadPool(threadPoolSize, new ThreadFactory()
            {
                private int count = 0;

                @Override
                public Thread newThread(Runnable r)
                {
                    Thread t = new Thread(r, "tile-pool-" + count++);
                    t.setPriority(Thread.MIN_PRIORITY);
                    t.setDaemon(true);
                    return t;
                }
            });
        }
        return service;
    }
233519
protected String encodeTicketId(final String ticketId) {
        if (!isCipherExecutorEnabled()) {
            LOGGER.trace(MESSAGE);
            return ticketId;
        }
        if (StringUtils.isBlank(ticketId)) {
            return ticketId;
        }
        val encodedId = DigestUtils.sha512(ticketId);
        LOGGER.debug("Encoded original ticket id [{}] to [{}]", ticketId, encodedId);
        return encodedId;
    }
27954
public static boolean checkClientSecret(final OAuthRegisteredService registeredService, final String clientSecret) {
        LOGGER.debug("Found: [{}] in secret check", registeredService);
        if (StringUtils.isBlank(registeredService.getClientSecret())) {
            LOGGER.debug("The client secret is not defined for the registered service [{}]", registeredService.getName());
            return true;
        }
        if (!StringUtils.equals(registeredService.getClientSecret(), clientSecret)) {
            LOGGER.error("Wrong client secret for service: [{}]", registeredService.getServiceId());
            return false;
        }
        return true;
    }
1275956
public TimerService get(String id) {
        if (id == null) {
            return null;
        }
        return this.registeredServices.get(id);
    }
806610
protected Assertion validateServiceTicket(final WebApplicationService service, final String serviceTicketId) {
        return serviceValidateConfigurationContext.getCentralAuthenticationService().validateServiceTicket(serviceTicketId, service);
    }
1246925
public Service retrieve(final RequestContext requestContext, final WebContext webContext, final BaseClient client) {
        val clientId = getDelegatedClientId(webContext, client);
        val ticket = retrieveSessionTicketViaClientId(webContext, clientId);
        restoreDelegatedAuthenticationRequest(requestContext, webContext, ticket);
        LOGGER.debug("Removing delegated client identifier [{}} from registry", ticket.getId());
        this.ticketRegistry.deleteTicket(ticket.getId());
        return ticket.getService();

    }
826381
protected RegisteredService getRegisteredServiceFromRequest(final RequestContext requestContext, final String entityId) {
        val currentService = WebUtils.getService(requestContext);
        val service = this.serviceFactory.createService(entityId);
        var registeredService = this.servicesManager.findServiceBy(service);
        if (registeredService == null) {
            LOGGER.debug("Entity id [{}] not found in the registry. Fallback onto [{}]", entityId, currentService);
            registeredService = this.servicesManager.findServiceBy(currentService);
        }
        LOGGER.debug("Located service definition [{}]", registeredService);
        return registeredService;
    }
1012406
public Optional<String> getSigningKey(final RegisteredService registeredService) {
        val property = getSigningKeyRegisteredServiceProperty();
        if (property.isAssignedTo(registeredService)) {
            val signingKey = property.getPropertyValue(registeredService).getValue();
            return Optional.of(signingKey);
        }
        return Optional.empty();
    }
316839
protected JsonWebKey getJsonWebKeyForEncryption(final OidcRegisteredService svc) {
        LOGGER.debug("Service [{}] is set to encrypt tokens", svc);
        val jwks = this.serviceJsonWebKeystoreCache.get(svc);
        if (Objects.requireNonNull(jwks).isEmpty()) {
            throw new IllegalArgumentException("Service " + svc.getServiceId()
                + " with client id " + svc.getClientId()
                + " is configured to encrypt tokens, yet no JSON web key is available");
        }
        val jsonWebKey = jwks.get();
        LOGGER.debug("Found JSON web key to encrypt the token: [{}]", jsonWebKey);
        if (jsonWebKey.getPublicKey() == null) {
            throw new IllegalArgumentException("JSON web key used to sign the token has no associated public key");
        }
        return jsonWebKey;
    }
1193132
public String getUserRegistryRealm(AtomicServiceReference<SecurityService> securityServiceRef) {
        String realm = "defaultRealm";
        try {
            SecurityService securityService = securityServiceRef.getService();
            UserRegistryService userRegistryService = securityService.getUserRegistryService();
            if (userRegistryService.isUserRegistryConfigured()) {
                realm = userRegistryService.getUserRegistry().getRealm();
            }
        } catch (RegistryException re) {
            if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
                Tr.debug(tc, "RegistryException while trying to get the realm", re);
            }
        }
        return realm;
    }
894022
public TokenAuthenticationManager getTokenAuthenticationManager() {
        if (tokenManager != null) {
            return tokenManager;
        }
        tokenManager = (TokenAuthenticationManager) ContainerManager.getComponent("tokenAuthenticationManager");
        return tokenManager;
    }
1083126
protected OAuthRegisteredService getOAuthRegisteredServiceBy(final HttpServletRequest request) {
        val redirectUri = getRegisteredServiceIdentifierFromRequest(request);
        val registeredService = OAuth20Utils.getRegisteredOAuthServiceByRedirectUri(getOAuthConfigurationContext().getServicesManager(), redirectUri);
        LOGGER.debug("Located registered service [{}]", registeredService);
        return registeredService;
    }
832158
protected String produceTicketIdentifier() {
        val pgtId = this.ticketGrantingTicketUniqueTicketIdGenerator.getNewTicketId(ProxyGrantingTicket.PROXY_GRANTING_TICKET_PREFIX);
        if (this.cipherExecutor == null) {
            return pgtId;
        }
        LOGGER.debug("Attempting to encode proxy-granting ticket [{}]", pgtId);
        val pgtEncoded = this.cipherExecutor.encode(pgtId);
        LOGGER.debug("Encoded proxy-granting ticket id [{}]", pgtEncoded);
        return pgtEncoded;
    }
80653
@SneakyThrows
    protected Ticket decodeTicket(final Ticket result) {
        if (!isCipherExecutorEnabled()) {
            LOGGER.trace(MESSAGE);
            return result;
        }
        if (result == null) {
            LOGGER.warn("Ticket passed is null and cannot be decoded");
            return null;
        }
        if (!result.getClass().isAssignableFrom(EncodedTicket.class)) {
            LOGGER.warn("Ticket passed is not an encoded ticket type; rather it's a [{}], no decoding is necessary.", result.getClass().getSimpleName());
            return result;
        }
        LOGGER.debug("Attempting to decode [{}]", result);
        val encodedTicket = (EncodedTicket) result;
        val ticket = SerializationUtils.decodeAndDeserializeObject(encodedTicket.getEncodedTicket(), this.cipherExecutor, Ticket.class);
        LOGGER.debug("Decoded ticket to [{}]", ticket);
        return ticket;
    }