Callback method to be called when authentication process finishes.
@param infoOriginal the authentication information that successfully authenticated.
@param context the current application context (that can be used to launch ui or access resources).
331749
public void onAuthenticated(BoxAuthenticationInfo infoOriginal, Context context) {
        BoxAuthenticationInfo info = BoxAuthenticationInfo.unmodifiableObject(infoOriginal);
        if (!SdkUtils.isBlank(info.accessToken()) && (info.getUser() == null || SdkUtils.isBlank(info.getUser().getId()))){
            // insufficient information so we need to fetch the user info first.
            doUserRefresh(context, info);
            return;
        }
        getAuthInfoMap(context).put(info.getUser().getId(), info.clone());
        authStorage.storeLastAuthenticatedUserId(info.getUser().getId(), context);
        authStorage.storeAuthInfoMap(mCurrentAccessInfo, context);
        // if accessToken has not already been refreshed, issue refresh request and cache result
        Set<AuthListener> listeners = getListeners();
        for (AuthListener listener : listeners) {
            listener.onAuthCreated(info);
        }
    }
579341
protected URI determineUnauthorizedServiceRedirectUrl(final RequestContext context) {
        val redirectUrl = WebUtils.getUnauthorizedRedirectUrlFromFlowScope(context);
        val currentEvent = context.getCurrentEvent();
        val eventAttributes = currentEvent.getAttributes();
        LOGGER.debug("Finalizing the unauthorized redirect URL [{}] when processing event [{}] with attributes [{}]",
            redirectUrl, currentEvent.getId(), eventAttributes);
        return redirectUrl;
    }
1113676
protected void activate(ComponentContext context) {
        securityServiceRef.activate(context);
        unauthSubjectServiceRef.activate(context);
        authServiceRef.activate(context);
        credServiceRef.activate(context);
    }
614500
public synchronized void logoutAllUsers(Context context) {
        getAuthInfoMap(context);
        for (String userId : mCurrentAccessInfo.keySet()) {
            BoxSession session = new BoxSession(context, userId);
            logout(session);
        }
        authStorage.clearAuthInfoMap(context);

    }
1268716
public static void setCallbackContextOnThread(SMailCallbackContext callbackContext) {
        if (callbackContext == null) {
            String msg = "The argument 'callbackContext' must not be null.";
            throw new IllegalArgumentException(msg);
        }
        getActiveHolder().save(callbackContext);
    }
494326
@Api
	public void restoreSecurityContext(SavedAuthorization savedAuthorization) {
		List<Authentication> auths = new ArrayList<Authentication>();
		if (null != savedAuthorization) {
			for (SavedAuthentication sa : savedAuthorization.getAuthentications()) {
				Authentication auth = new Authentication();
				auth.setSecurityServiceId(sa.getSecurityServiceId());
				auth.setAuthorizations(sa.getAuthorizations());
				auths.add(auth);
			}
		}
		setAuthentications(null, auths);
		userInfoInit();
	}
1100494
@Activate
    protected void activate(ComponentContext context) {
        if (TraceComponent.isAnyTracingEnabled() && tc.isEventEnabled())
            Tr.event(tc, "activate", context);
    }
661654
protected void saveRequestedUrl(final C context, final List<Client> currentClients, AjaxRequestResolver ajaxRequestResolver) {
        if (ajaxRequestResolver == null || !ajaxRequestResolver.isAjax(context)) {
            savedRequestHandler.save(context);
        }
    }
419641
public static void putAuthenticationResult(final AuthenticationResult authenticationResult, final RequestContext context) {
        context.getConversationScope().put(PARAMETER_AUTHENTICATION_RESULT, authenticationResult);
    }
154673
protected void deactivate(ComponentContext context) {
        if (TraceComponent.isAnyTracingEnabled() && tc.isEventEnabled())
            Tr.event(tc, "deactivate", context);
        authDataServiceRef.deactivate(context);
        deferrableSchedXSvcRef.deactivate(context);
        execSvcRef.deactivate(context);
        nonDeferrableSchedXSvcRef.deactivate(context);
        rrsXAResFactorySvcRef.deactivate(context);
        variableRegistrySvcRef.deactivate(context);
    }
258714
protected Set<Event> handleAuthenticationTransactionAndGrantTicketGrantingTicket(final RequestContext context) {
        val response = WebUtils.getHttpServletResponseFromExternalWebflowContext(context);
        try {
            val credential = getCredentialFromContext(context);
            val builderResult = WebUtils.getAuthenticationResultBuilder(context);

            LOGGER.debug("Handling authentication transaction for credential [{}]", credential);
            val service = WebUtils.getService(context);
            val builder = webflowEventResolutionConfigurationContext.getAuthenticationSystemSupport()
                .handleAuthenticationTransaction(service, builderResult, credential);

            LOGGER.debug("Issuing ticket-granting tickets for service [{}]", service);
            return CollectionUtils.wrapSet(grantTicketGrantingTicketToAuthenticationResult(context, builder, service));
        } catch (final Exception e) {
            LOGGER.error(e.getMessage(), e);
            val messageContext = context.getMessageContext();
            messageContext.addMessage(new MessageBuilder()
                .error()
                .code(DEFAULT_MESSAGE_BUNDLE_PREFIX.concat(e.getClass().getSimpleName()))
                .build());
            response.setStatus(HttpStatus.UNAUTHORIZED.value());
            return CollectionUtils.wrapSet(getAuthenticationFailureErrorEvent(context));
        }
    }
653640
@Override
    public void handle(RequestContext context, AuthenticationException e) throws SecurityProviderException,
            IOException {
        String targetUrl = getTargetUrl();
        if (StringUtils.isNotEmpty(targetUrl)) {
            RedirectUtils.redirect(context.getRequest(), context.getResponse(), targetUrl);
        } else {
            sendError(e, context);
        }
    }
638443
private void invokeAuthorizationRequest(Context context) {

        AuthorizationRequestManager.RequestOptions options = new AuthorizationRequestManager.RequestOptions();

        options.parameters = createAuthorizationParams();
        options.headers = new HashMap<>(1);
        addSessionIdHeader(options.headers);
        options.requestMethod = Request.GET;

        InnerAuthorizationResponseListener listener = new InnerAuthorizationResponseListener() {
            @Override
            public void handleAuthorizationSuccessResponse(Response response) throws Exception {

                String location = extractLocationHeader(response);
                String grantCode = extractGrantCode(location);
                invokeTokenRequest(grantCode);
            }
        };

        authorizationRequestSend(context, "authorization", options, listener);
    }
73318
protected void broadcastLogin(Authentication authentication) {
        if( logger.isDebugEnabled() )
            logger.debug( "BROADCAST login: token=" + authentication );

        final Iterator iter = getBeansToUpdate( LoginAware.class ).iterator();
        while( iter.hasNext() ) {
            ((LoginAware) iter.next()).userLogin( authentication );
        }
    }
558836
private void invokeInstanceRegistrationRequest(final Context context) {

        AuthorizationRequestManager.RequestOptions options = new AuthorizationRequestManager.RequestOptions();

        options.parameters = createRegistrationParams();
        options.headers = createRegistrationHeaders();
        options.requestMethod = Request.POST;

        InnerAuthorizationResponseListener listener = new InnerAuthorizationResponseListener() {
            @Override
            public void handleAuthorizationSuccessResponse(Response response) throws Exception {
                saveCertificateFromResponse(response);
                invokeAuthorizationRequest(context);
            }
        };

        authorizationRequestSend(null, "clients/instance", options, listener);
    }
794362
protected void activate(final ComponentContext context)
			throws InvalidSyntaxException {
		log.info("activate");

		bundleContext = context.getBundleContext();

		sl = new ServiceListener() {
			public void serviceChanged(ServiceEvent event) {
				if (event.getType() == ServiceEvent.UNREGISTERING) {
					cache.unregisterComponentBindingsProvider(event
							.getServiceReference());
				} else if (event.getType() == ServiceEvent.REGISTERED) {
					cache.registerComponentBindingsProvider(event
							.getServiceReference());
				}
			}
		};
		bundleContext.addServiceListener(sl, "(" + Constants.OBJECTCLASS + "="
				+ ComponentBindingsProvider.class.getName() + ")");
		reloadCache();
		log.info("Activation successful");
	}
415212
@Override
  public Data process(Data context) throws ProcessingStageException {
    try {
      keyChain.sign(context, certificateName);
    } catch (SecurityException e) {
      throw new ProcessingStageException(e);
    }
    return context;
  }