store.setTransientAttributes(loginTicketId, ssoTicketId);
store.setTransientSSOAttributes(loginTicketId, ssoTicketId, authzManager.getNonSSOAttributeNames(authnAttempt.getServicePrincipal()));
    public static String attemptSingleSignOn(final String loginTicketId, final String ssoTicketId)    throws UnknownTicketException, InoperableStateException,    IllegalInputException {        /* Check controller status */        if (!ready) { throw new InoperableStateException(NOT_READY); }        /* Validate arguments */        if (loginTicketId == null || loginTicketId.equals("")) { throw new IllegalInputException("loginTicketId must be a non-empty string."); }        if (ssoTicketId == null || ssoTicketId.equals("")) { throw new IllegalInputException("ssoTicketId must be a non-empty string."); }        /* Get authentication attempt */        final MoriaAuthnAttempt authnAttempt;        try {            authnAttempt = store.getAuthnAttempt(loginTicketId, true, null);        } catch (InvalidTicketException e) {            accessLogger.logUser(AccessStatusType.INVALID_LOGIN_TICKET, null, null, loginTicketId, null);            messageLogger.logWarn(CAUGHT_INVALID_TICKET, loginTicketId, e);            throw new UnknownTicketException(NONEXISTENT_TICKET);        } catch (NonExistentTicketException e) {            accessLogger.logUser(AccessStatusType.NONEXISTENT_LOGIN_TICKET, null, null, loginTicketId, null);            messageLogger.logInfo(CAUGHT_NONEXISTENT_TICKET, loginTicketId, e);            throw new UnknownTicketException(NONEXISTENT_TICKET);        } catch (MoriaStoreException e) {            messageLogger.logCritical(CAUGHT_STORE, loginTicketId, e);            throw new InoperableStateException(STORE_DOWN);        }        /* Check if SSO is enabled in authentication attempt */        if (authnAttempt.isForceInterativeAuthentication()) {            messageLogger.logInfo("SSO authentication attempt denied by web service provider.");            throw new UnknownTicketException("Authentication attempt requires interactive authentication.");        }        /* Service can only request cached attributes or SSO fails */        final String[] requestedAttributes = authnAttempt.getRequestedAttributes();        final HashSet cachedAttributes = authzManager.getCachableAttributes();        for (int i = 0; i < requestedAttributes.length; i++) {            if (!cachedAttributes.contains(requestedAttributes[i])) {                messageLogger.logDebug("SSO authentication failed, request for non-cached attributes.");                throw new UnknownTicketException("SSO ticket not sufficient, service requests uncached attributes.");            }        }        /* Transfer attributes from cached user data to authentication attempt. */        final String serviceTicket;        try {            /* Put transient attributes into authnattempt */            store.setTransientAttributes(loginTicketId, ssoTicketId);            /* set loginTicket userorg from SSO ticket */            String userorg = store.getTicketUserorg(ssoTicketId, MoriaTicketType.SSO_TICKET);            store.setTicketUserorg(loginTicketId, MoriaTicketType.LOGIN_TICKET, userorg);            /* Get service ticket */            serviceTicket = store.createServiceTicket(loginTicketId);        } catch (InvalidTicketException e) {            accessLogger.logUser(AccessStatusType.INVALID_SSO_TICKET, null, null, ssoTicketId, null);            messageLogger.logWarn(CAUGHT_INVALID_TICKET, ssoTicketId, e);            throw new UnknownTicketException(NONEXISTENT_TICKET);        } catch (NonExistentTicketException e) {            accessLogger.logUser(AccessStatusType.NONEXISTENT_SSO_TICKET, null, null, ssoTicketId, null);            messageLogger.logInfo(CAUGHT_NONEXISTENT_TICKET, ssoTicketId, e);            throw new UnknownTicketException(NONEXISTENT_TICKET);        } catch (MoriaStoreException e) {            messageLogger.logCritical(CAUGHT_STORE, ssoTicketId, e);            throw new InoperableStateException(STORE_DOWN);        }        accessLogger.logUser(AccessStatusType.SUCCESSFUL_SSO_AUTHENTICATION, authnAttempt.getServicePrincipal(), null, loginTicketId, serviceTicket);        return serviceTicket;    }