Search in sources :

Example 1 with RealmParameter

use of net.petafuel.styx.core.xs2a.callback.entity.RealmParameter in project styx by petafuel.

the class CallbackHandler method handleCallback.

public static Response handleCallback(String serviceRealm, String realmParameter, String xRequestId, OAuthCallback oAuthCallback) {
    ServiceRealm requestedServiceRealm;
    RealmParameter receivedRealmParameter;
    RedirectStatus redirectStatus = null;
    try {
        requestedServiceRealm = ServiceRealm.valueOf(serviceRealm.toUpperCase());
    } catch (IllegalArgumentException unknownRealmException) {
        LOG.warn("Callback was received with an unknown serviceRealm={}", serviceRealm);
        requestedServiceRealm = ServiceRealm.UNKNOWN;
    }
    try {
        receivedRealmParameter = RealmParameter.valueOf(realmParameter.toUpperCase());
    } catch (IllegalArgumentException unknownRealmException) {
        LOG.warn("Callback was received with an unknown realmParameter={}", realmParameter);
        receivedRealmParameter = RealmParameter.UNKNOWN;
    }
    LOG.info("Received callback for resource serviceRealm={}, realmParameter={}, originRequestUUID={}, oAuthCallback={}", requestedServiceRealm, realmParameter, xRequestId, oAuthCallback);
    if (oAuthCallback != null && (oAuthCallback.getCode() != null || oAuthCallback.getError() != null)) {
        redirectStatus = OAuthCallbackProcessor.processCallback(requestedServiceRealm, receivedRealmParameter, xRequestId, oAuthCallback);
    }
    if (redirectStatus == null) {
        redirectStatus = RedirectCallbackProcessor.processCallback(requestedServiceRealm, receivedRealmParameter, xRequestId);
    }
    return StatusHelper.createStatusRedirection(redirectStatus);
}
Also used : RedirectStatus(net.petafuel.styx.api.v1.status.entity.RedirectStatus) RealmParameter(net.petafuel.styx.core.xs2a.callback.entity.RealmParameter) ServiceRealm(net.petafuel.styx.core.xs2a.callback.entity.ServiceRealm)

Aggregations

RedirectStatus (net.petafuel.styx.api.v1.status.entity.RedirectStatus)1 RealmParameter (net.petafuel.styx.core.xs2a.callback.entity.RealmParameter)1 ServiceRealm (net.petafuel.styx.core.xs2a.callback.entity.ServiceRealm)1