Java Code Examples for org.gluu.oxauth.model.util.Util#listAsString()

The following examples show how to use org.gluu.oxauth.model.util.Util#listAsString() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: Configuration.java    From oxTrust with MIT License 6 votes vote down vote up
public String getPropertyValue(String propertyName) {
   	if (StringHelper.equalsIgnoreCase(Configuration.OAUTH_PROPERTY_AUTHORIZE_URL, propertyName)) {
   		return openIdConfiguration.getAuthorizationEndpoint();
   	} else if (StringHelper.equalsIgnoreCase(Configuration.OAUTH_PROPERTY_TOKEN_URL, propertyName)) {
   		return openIdConfiguration.getTokenEndpoint();
   	} else if (StringHelper.equalsIgnoreCase(Configuration.OAUTH_PROPERTY_USERINFO_URL, propertyName)) {
   		return openIdConfiguration.getUserInfoEndpoint();
   	} else if (StringHelper.equalsIgnoreCase(Configuration.OAUTH_PROPERTY_LOGOUT_URL, propertyName)) {
   		return openIdConfiguration.getEndSessionEndpoint();
   	} else if (StringHelper.equalsIgnoreCase(Configuration.OAUTH_PROPERTY_LOGOUT_REDIRECT_URL, propertyName)) {
   		return appConfiguration.getOpenIdPostLogoutRedirectUri();
   	} else if (StringHelper.equalsIgnoreCase(Configuration.OAUTH_PROPERTY_CLIENT_ID, propertyName)) {
   		return appConfiguration.getOpenIdClientId();
   	} else if (StringHelper.equalsIgnoreCase(Configuration.OAUTH_PROPERTY_CLIENT_PASSWORD, propertyName)) {
   		return appConfiguration.getOpenIdClientPassword();
   	} else if (StringHelper.equalsIgnoreCase(Configuration.OAUTH_PROPERTY_CLIENT_SCOPE, propertyName)) {
   		return Util.listAsString(appConfiguration.getOpenIdScopes());
   	}

   	return null;
}
 
Example 2
Source File: BackchannelAuthenticationRequest.java    From oxAuth with MIT License 6 votes vote down vote up
@Override
public String getQueryString() {
    QueryBuilder builder = QueryBuilder.instance();

    final String scopesAsString = Util.listAsString(scope);
    final String acrValuesAsString = Util.listAsString(acrValues);

    builder.append(BackchannelAuthenticationRequestParam.SCOPE, scopesAsString);
    builder.append(BackchannelAuthenticationRequestParam.CLIENT_NOTIFICATION_TOKEN, clientNotificationToken);
    builder.append(BackchannelAuthenticationRequestParam.ACR_VALUES, acrValuesAsString);
    builder.append(BackchannelAuthenticationRequestParam.LOGIN_HINT_TOKEN, loginHintToken);
    builder.append(BackchannelAuthenticationRequestParam.ID_TOKEN_HINT, idTokenHint);
    builder.append(BackchannelAuthenticationRequestParam.LOGIN_HINT, loginHint);
    builder.append(BackchannelAuthenticationRequestParam.BINDING_MESSAGE, bindingMessage);
    builder.append(BackchannelAuthenticationRequestParam.USER_CODE, userCode);
    builder.appendIfNotNull(BackchannelAuthenticationRequestParam.REQUESTED_EXPIRY, requestedExpiry);
    builder.appendIfNotNull(BackchannelAuthenticationRequestParam.CLIENT_ID, clientId);
    builder.appendIfNotNull(BackchannelAuthenticationRequestParam.REQUEST, request);
    builder.appendIfNotNull(BackchannelAuthenticationRequestParam.REQUEST_URI, requestUri);

    appendClientAuthnToQuery(builder);
    return builder.toString();
}
 
Example 3
Source File: BackchannelAuthenticationClient.java    From oxAuth with MIT License 4 votes vote down vote up
private BackchannelAuthenticationResponse exec_() throws Exception {
    // Prepare request parameters
    clientRequest.setHttpMethod(getHttpMethod());
    clientRequest.header("Content-Type", request.getContentType());
    if (request.getAuthenticationMethod() == AuthenticationMethod.CLIENT_SECRET_BASIC && request.hasCredentials()) {
        clientRequest.header("Authorization", "Basic " + request.getEncodedCredentials());
    }

    final String scopesAsString = Util.listAsString(getRequest().getScope());
    final String acrValuesAsString = Util.listAsString(getRequest().getAcrValues());

    if (StringUtils.isNotBlank(scopesAsString)) {
        clientRequest.formParameter(SCOPE, scopesAsString);
    }
    if (StringUtils.isNotBlank(getRequest().getClientNotificationToken())) {
        clientRequest.formParameter(CLIENT_NOTIFICATION_TOKEN, getRequest().getClientNotificationToken());
    }
    if (StringUtils.isNotBlank(acrValuesAsString)) {
        clientRequest.formParameter(ACR_VALUES, acrValuesAsString);
    }
    if (StringUtils.isNotBlank(getRequest().getLoginHintToken())) {
        clientRequest.formParameter(LOGIN_HINT_TOKEN, getRequest().getLoginHintToken());
    }
    if (StringUtils.isNotBlank(getRequest().getIdTokenHint())) {
        clientRequest.formParameter(ID_TOKEN_HINT, getRequest().getIdTokenHint());
    }
    if (StringUtils.isNotBlank(getRequest().getLoginHint())) {
        clientRequest.formParameter(LOGIN_HINT, getRequest().getLoginHint());
    }
    if (StringUtils.isNotBlank(getRequest().getBindingMessage())) {
        clientRequest.formParameter(BINDING_MESSAGE, getRequest().getBindingMessage());
    }
    if (StringUtils.isNotBlank(getRequest().getUserCode())) {
        clientRequest.formParameter(USER_CODE, getRequest().getUserCode());
    }
    if (getRequest().getRequestedExpiry() != null) {
        clientRequest.formParameter(REQUESTED_EXPIRY, getRequest().getRequestedExpiry());
    }
    if (StringUtils.isNotBlank(getRequest().getClientId())) {
        clientRequest.formParameter(CLIENT_ID, getRequest().getClientId());
    }
    if (StringUtils.isNotBlank(getRequest().getRequest())) {
        clientRequest.formParameter(REQUEST, getRequest().getRequest());
    }
    if (StringUtils.isNotBlank(getRequest().getRequestUri())) {
        clientRequest.formParameter(REQUEST_URI, getRequest().getRequestUri());
    }
    new ClientAuthnEnabler(clientRequest).exec(getRequest());

    // Call REST Service and handle response
    clientResponse = clientRequest.post(String.class);

    setResponse(new BackchannelAuthenticationResponse(clientResponse));
    String entity = clientResponse.getEntity(String.class);
    getResponse().setEntity(entity);
    getResponse().setHeaders(clientResponse.getMetadata());
    if (StringUtils.isNotBlank(entity)) {
        JSONObject jsonObj = new JSONObject(entity);

        if (jsonObj.has(AUTH_REQ_ID)) {
            getResponse().setAuthReqId(jsonObj.getString(AUTH_REQ_ID));
        }
        if (jsonObj.has(EXPIRES_IN)) {
            getResponse().setExpiresIn(jsonObj.getInt(EXPIRES_IN));
        }
        if (jsonObj.has(INTERVAL)) {
            getResponse().setInterval(jsonObj.getInt(INTERVAL));
        }
    }

    return getResponse();
}
 
Example 4
Source File: AuthorizationRequest.java    From oxAuth with MIT License 4 votes vote down vote up
public String getScopesAsString() {
    return Util.listAsString(scopes);
}
 
Example 5
Source File: AuthorizationRequest.java    From oxAuth with MIT License 4 votes vote down vote up
public String getUiLocalesAsString() {
    return Util.listAsString(uiLocales);
}
 
Example 6
Source File: AuthorizationRequest.java    From oxAuth with MIT License 4 votes vote down vote up
public String getClaimsLocalesAsString() {
    return Util.listAsString(claimsLocales);
}
 
Example 7
Source File: AuthorizationRequest.java    From oxAuth with MIT License 4 votes vote down vote up
public String getAcrValuesAsString() {
    return Util.listAsString(acrValues);
}