private String dn(String p_id) { final String baseDn = getBaseDn(); final StringBuilder sb = new StringBuilder(); if (Util.allNotBlank(p_id, getBaseDn())) { sb.append("oxAuthSessionId=").append(p_id).append(",").append(baseDn); } return sb.toString(); }
"<head>"; if (!Util.isNullOrEmpty(postLogoutUrl)) { if (!Util.isNullOrEmpty(state)) { if (postLogoutUrl.contains("?")) { postLogoutUrl += "&state=" + state;
public String getUiLocalesAsString() { return Util.listAsString(uiLocales); }
Util.addToJSONObjectIfNotNull(responseJsonObject, RegisterResponseParam.CLIENT_ID.toString(), client.getClientId()); Util.addToJSONObjectIfNotNull(responseJsonObject, CLIENT_SECRET.toString(), clientService.decryptSecret(client.getClientSecret())); Util.addToJSONObjectIfNotNull(responseJsonObject, RegisterResponseParam.REGISTRATION_ACCESS_TOKEN.toString(), client.getRegistrationAccessToken()); Util.addToJSONObjectIfNotNull(responseJsonObject, REGISTRATION_CLIENT_URI.toString(), appConfiguration.getRegistrationEndpoint() + "?" + RegisterResponseParam.CLIENT_ID.toString() + "=" + client.getClientId()); Util.addToJSONObjectIfNotNull(responseJsonObject, REDIRECT_URIS.toString(), client.getRedirectUris()); Util.addToJSONObjectIfNotNull(responseJsonObject, CLAIMS_REDIRECT_URIS.toString(), client.getClaimRedirectUris()); Util.addToJSONObjectIfNotNull(responseJsonObject, RESPONSE_TYPES.toString(), ResponseType.toStringArray(client.getResponseTypes())); Util.addToJSONObjectIfNotNull(responseJsonObject, GRANT_TYPES.toString(), GrantType.toStringArray(client.getGrantTypes())); Util.addToJSONObjectIfNotNull(responseJsonObject, APPLICATION_TYPE.toString(), client.getApplicationType()); Util.addToJSONObjectIfNotNull(responseJsonObject, CONTACTS.toString(), client.getContacts()); Util.addToJSONObjectIfNotNull(responseJsonObject, CLIENT_NAME.toString(), client.getClientName()); Util.addToJSONObjectIfNotNull(responseJsonObject, LOGO_URI.toString(), client.getLogoUri()); Util.addToJSONObjectIfNotNull(responseJsonObject, CLIENT_URI.toString(), client.getClientUri()); Util.addToJSONObjectIfNotNull(responseJsonObject, POLICY_URI.toString(), client.getPolicyUri()); Util.addToJSONObjectIfNotNull(responseJsonObject, TOS_URI.toString(), client.getTosUri()); Util.addToJSONObjectIfNotNull(responseJsonObject, JWKS_URI.toString(), client.getJwksUri()); Util.addToJSONObjectIfNotNull(responseJsonObject, SECTOR_IDENTIFIER_URI.toString(), client.getSectorIdentifierUri()); Util.addToJSONObjectIfNotNull(responseJsonObject, SUBJECT_TYPE.toString(), client.getSubjectType()); Util.addToJSONObjectIfNotNull(responseJsonObject, ID_TOKEN_SIGNED_RESPONSE_ALG.toString(), client.getIdTokenSignedResponseAlg()); Util.addToJSONObjectIfNotNull(responseJsonObject, ID_TOKEN_ENCRYPTED_RESPONSE_ALG.toString(), client.getIdTokenEncryptedResponseAlg()); Util.addToJSONObjectIfNotNull(responseJsonObject, ID_TOKEN_ENCRYPTED_RESPONSE_ENC.toString(), client.getIdTokenEncryptedResponseEnc()); Util.addToJSONObjectIfNotNull(responseJsonObject, USERINFO_SIGNED_RESPONSE_ALG.toString(), client.getUserInfoSignedResponseAlg()); Util.addToJSONObjectIfNotNull(responseJsonObject, USERINFO_ENCRYPTED_RESPONSE_ALG.toString(), client.getUserInfoEncryptedResponseAlg()); Util.addToJSONObjectIfNotNull(responseJsonObject, USERINFO_ENCRYPTED_RESPONSE_ENC.toString(), client.getUserInfoEncryptedResponseEnc()); Util.addToJSONObjectIfNotNull(responseJsonObject, REQUEST_OBJECT_SIGNING_ALG.toString(), client.getRequestObjectSigningAlg()); Util.addToJSONObjectIfNotNull(responseJsonObject, REQUEST_OBJECT_ENCRYPTION_ALG.toString(), client.getRequestObjectEncryptionAlg());
public static String getEncodedCredentials(String clientId, String clientSecret) throws UnsupportedEncodingException { return Base64.encodeBase64String(Util.getBytes(URLEncoder.encode(clientId, Util.UTF8_STRING_ENCODING) + ":" + URLEncoder.encode(clientSecret, Util.UTF8_STRING_ENCODING))); }
public String getCustomResponseHeadersAsString() throws JSONException { return Util.mapAsString(customResponseHeaders); }
result = JsonLogic.apply(rule); } else { result = JsonLogic.apply(rule, Util.asJsonSilently(evaluatedResults)); log.trace("JsonLogic evaluation result: " + result + ", rule: " + rule + ", data:" + Util.asJsonSilently(evaluatedResults)); if (result) {
responseTypes = Util.asEnumList(responseTypesJsonArray, ResponseType.class); grantTypes = Util.asEnumList(grantTypesJsonArray, GrantType.class);
getResponse().setScopeToClaimsMapping(OpenIdConfigurationResponse.parseScopeToClaimsMapping(jsonObj.getJSONArray(SCOPE_TO_CLAIMS_MAPPING))); Util.addToListIfHas(getResponse().getScopesSupported(), jsonObj, SCOPES_SUPPORTED); Util.addToListIfHas(getResponse().getResponseTypesSupported(), jsonObj, RESPONSE_TYPES_SUPPORTED); Util.addToListIfHas(getResponse().getGrantTypesSupported(), jsonObj, GRANT_TYPES_SUPPORTED); Util.addToListIfHas(getResponse().getAcrValuesSupported(), jsonObj, ACR_VALUES_SUPPORTED); Util.addToListIfHas(getResponse().getSubjectTypesSupported(), jsonObj, SUBJECT_TYPES_SUPPORTED); Util.addToListIfHas(getResponse().getUserInfoSigningAlgValuesSupported(), jsonObj, USER_INFO_SIGNING_ALG_VALUES_SUPPORTED); Util.addToListIfHas(getResponse().getUserInfoEncryptionAlgValuesSupported(), jsonObj, USER_INFO_ENCRYPTION_ALG_VALUES_SUPPORTED); Util.addToListIfHas(getResponse().getUserInfoEncryptionEncValuesSupported(), jsonObj, USER_INFO_ENCRYPTION_ENC_VALUES_SUPPORTED); Util.addToListIfHas(getResponse().getIdTokenSigningAlgValuesSupported(), jsonObj, ID_TOKEN_SIGNING_ALG_VALUES_SUPPORTED); Util.addToListIfHas(getResponse().getIdTokenEncryptionAlgValuesSupported(), jsonObj, ID_TOKEN_ENCRYPTION_ALG_VALUES_SUPPORTED); Util.addToListIfHas(getResponse().getIdTokenEncryptionEncValuesSupported(), jsonObj, ID_TOKEN_ENCRYPTION_ENC_VALUES_SUPPORTED); Util.addToListIfHas(getResponse().getRequestObjectSigningAlgValuesSupported(), jsonObj, REQUEST_OBJECT_SIGNING_ALG_VALUES_SUPPORTED); Util.addToListIfHas(getResponse().getRequestObjectEncryptionAlgValuesSupported(), jsonObj, REQUEST_OBJECT_ENCRYPTION_ALG_VALUES_SUPPORTED); Util.addToListIfHas(getResponse().getRequestObjectEncryptionEncValuesSupported(), jsonObj, REQUEST_OBJECT_ENCRYPTION_ENC_VALUES_SUPPORTED); Util.addToListIfHas(getResponse().getTokenEndpointAuthMethodsSupported(), jsonObj, TOKEN_ENDPOINT_AUTH_METHODS_SUPPORTED); Util.addToListIfHas(getResponse().getTokenEndpointAuthSigningAlgValuesSupported(), jsonObj, TOKEN_ENDPOINT_AUTH_SIGNING_ALG_VALUES_SUPPORTED); Util.addToListIfHas(getResponse().getDisplayValuesSupported(), jsonObj, DISPLAY_VALUES_SUPPORTED); Util.addToListIfHas(getResponse().getClaimTypesSupported(), jsonObj, CLAIM_TYPES_SUPPORTED); Util.addToListIfHas(getResponse().getClaimsSupported(), jsonObj, CLAIMS_SUPPORTED); if (jsonObj.has(SERVICE_DOCUMENTATION)) { getResponse().setServiceDocumentation(jsonObj.getString(SERVICE_DOCUMENTATION)); Util.addToListIfHas(getResponse().getClaimsLocalesSupported(), jsonObj, CLAIMS_LOCALES_SUPPORTED); Util.addToListIfHas(getResponse().getUiLocalesSupported(), jsonObj, UI_LOCALES_SUPPORTED); if (jsonObj.has(CLAIMS_PARAMETER_SUPPORTED)) { getResponse().setClaimsParameterSupported(jsonObj.getBoolean(CLAIMS_PARAMETER_SUPPORTED));
public static String encodeCredentials(String username, String password) throws UnsupportedEncodingException { return Base64.encodeBase64String(Util.getBytes(username + ":" + password)); } }
private void setExternalScriptExtraParameters(Map<String, String> sessionIdAttributes, Map<String, String> authExternalAttributes) { String authExternalAttributesString = null; try { authExternalAttributesString = Util.mapAsString(authExternalAttributes); } catch (JSONException ex) { logger.error("Failed to convert Map<String, String> of auth_external_attributes to JSON array"); } sessionIdAttributes.put(AUTH_EXTERNAL_ATTRIBUTES, authExternalAttributesString); }
public UmaPermission getPermissionFromRPTByResourceId(UmaRPT rpt, String resourceId) { try { if (Util.allNotBlank(resourceId)) { for (UmaPermission permission : getRptPermissions(rpt)) { if (resourceId.equals(permission.getResourceId())) { return permission; } } } } catch (Exception e) { log.error(e.getMessage(), e); } return null; }
public String getAcrValuesAsString() { return Util.listAsString(acrValues); }
/** * returns User by Dn * * @return User */ @Nullable public User getUserByDn(String dn, String... returnAttributes) { if (Util.isNullOrEmpty(dn)) { return null; } return ldapEntryManager.find(User.class, dn, returnAttributes); }
/** * Returns the client credentials encoded using base64. * * @return The encoded client credentials. */ public String getEncodedCredentials() { try { if (hasCredentials()) { return Base64.encodeBase64String(Util.getBytes(getCredentials())); } } catch (UnsupportedEncodingException e) { e.printStackTrace(); } return null; }
protected void addReqParam(String p_key, String p_value) { if (Util.allNotBlank(p_key, p_value)) { if (request.getAuthorizationMethod() == AuthorizationMethod.FORM_ENCODED_BODY_PARAMETER) { clientRequest.formParameter(p_key, p_value); } else { clientRequest.queryParameter(p_key, p_value); } } }
public String getScopesAsString() { return Util.listAsString(scopes); }
public void validateLogoutUri(String logoutUri, List<String> redirectUris, ErrorResponseFactory errorResponseFactory) { if (Util.isNullOrEmpty(logoutUri)) { // logout uri is optional so null or empty string is valid return; } // preconditions if (redirectUris == null || redirectUris.isEmpty()) { log.error("Preconditions of logout uri validation are failed."); throwInvalidLogoutUri(errorResponseFactory); return; } try { Set<String> redirectUriHosts = collectUriHosts(redirectUris); URI uri = new URI(logoutUri); if (!redirectUriHosts.contains(uri.getHost())) { log.error("logout uri host is not within redirect_uris, logout_uri: {}, redirect_uris: {}", logoutUri, redirectUris); throwInvalidLogoutUri(errorResponseFactory); return; } if (!HTTPS.equalsIgnoreCase(uri.getScheme())) { log.error("logout uri schema is not https, logout_uri: {}", logoutUri); throwInvalidLogoutUri(errorResponseFactory); } } catch (Exception e) { log.error(e.getMessage(), e); throwInvalidLogoutUri(errorResponseFactory); } }
tokenRequest.setAuthenticationMethod(AuthenticationMethod.CLIENT_SECRET_BASIC); String expectedEncodedCredentials = Base64.encodeBase64String(Util.getBytes( URLEncoder.encode(clientId, Util.UTF8_STRING_ENCODING) + ":"
public boolean isInNetwork(String cidrNotation) { final String ip = getIpAddress(); if (Util.allNotBlank(ip, cidrNotation)) { final SubnetUtils utils = new SubnetUtils(cidrNotation); return utils.getInfo().isInRange(ip); } return false; }