• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Java Util类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Java中org.xdi.oxauth.model.util.Util的典型用法代码示例。如果您正苦于以下问题:Java Util类的具体用法?Java Util怎么用?Java Util使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



Util类属于org.xdi.oxauth.model.util包,在下文中一共展示了Util类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。

示例1: getPropertyValue

import org.xdi.oxauth.model.util.Util; //导入依赖的package包/类
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_TOKEN_VALIDATION_URL, propertyName)) {
   		return openIdConfiguration.getValidateTokenEndpoint();
   	} 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;
}
 
开发者ID:AgarwalNeha1,项目名称:gluu,代码行数:24,代码来源:Configuration.java


示例2: TestModeScimClient

import org.xdi.oxauth.model.util.Util; //导入依赖的package包/类
/**
 * Constructs a TestModeScimClient object with the specified parameters and service contract
 * @param serviceClass The service interface the underlying resteasy proxy client will adhere to. This proxy is used
 *                     internally to execute all requests to the service
 * @param serviceUrl The root URL of the SCIM service. Usually in the form {@code https://your.gluu-server.com/identity/restv1}
 * @param OIDCMetadataUrl URL of authorization servers' metadata document. Usually in the form {@code https://your.gluu-server.com/.well-known/openid-configuration}
 * @throws Exception If there was a problem contacting the authorization server to initialize this object
 */
public TestModeScimClient(Class<T> serviceClass, String serviceUrl, String OIDCMetadataUrl) throws Exception {

    super(serviceUrl, serviceClass);

    //Extract token, registration, and authz endpoints from metadata URL
    JsonNode tree=mapper.readTree(new URL(OIDCMetadataUrl));
    this.registrationEndpoint= tree.get("registration_endpoint").asText();
    this.tokenEndpoint=tree.get("token_endpoint").asText();
    //this.authzEndpoint=tree.get("authorization_endpoint").asText();

    if (Util.allNotBlank(registrationEndpoint, tokenEndpoint /*, authzEndpoint*/)) {
        triggerRegistrationIfNeeded();
        updateTokens(GrantType.CLIENT_CREDENTIALS);
    }
    else
        throw new Exception("Couldn't extract endpoints from OIDC metadata URL: " + OIDCMetadataUrl);

}
 
开发者ID:GluuFederation,项目名称:SCIM-Client,代码行数:27,代码来源:TestModeScimClient.java


示例3: getPropertyValue

import org.xdi.oxauth.model.util.Util; //导入依赖的package包/类
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;
}
 
开发者ID:GluuFederation,项目名称:oxTrust,代码行数:22,代码来源:Configuration.java


示例4: request

import org.xdi.oxauth.model.util.Util; //导入依赖的package包/类
public static Token request(final String tokenUrl, final String umaClientId, final String umaClientSecret, UmaScopeType scopeType,
                            ClientExecutor clientExecutor, String... scopeArray) throws Exception {

    String scope = scopeType.getValue();
    if (scopeArray != null && scopeArray.length > 0) {
        for (String s : scopeArray) {
            scope = scope + " " + s;
        }
    }

    TokenClient tokenClient = new TokenClient(tokenUrl);
    if (clientExecutor != null) {
        tokenClient.setExecutor(clientExecutor);
    }
    TokenResponse response = tokenClient.execClientCredentialsGrant(scope, umaClientId, umaClientSecret);

    if (response.getStatus() == 200) {
        final String patToken = response.getAccessToken();
        final Integer expiresIn = response.getExpiresIn();
        if (Util.allNotBlank(patToken)) {
            return new Token(null, null, patToken, scopeType.getValue(), expiresIn);
        }
    }

    return null;
}
 
开发者ID:GluuFederation,项目名称:oxAuth,代码行数:27,代码来源:UmaClient.java


示例5: parametersAsString

import org.xdi.oxauth.model.util.Util; //导入依赖的package包/类
public String parametersAsString(final Map<String, String> parameterMap) throws UnsupportedEncodingException {
    final StringBuilder sb = new StringBuilder();
    final Set<Entry<String, String>> set = parameterMap.entrySet();
    for (Map.Entry<String, String> entry : set) {
        final String value = (String) entry.getValue();
        if (StringUtils.isNotBlank(value)) {
            sb.append(entry.getKey()).append("=").append(URLEncoder.encode(value, Util.UTF8_STRING_ENCODING)).append("&");
        }
    }

    String result = sb.toString();
    if (result.endsWith("&")) {
        result = result.substring(0, result.length() - 1);
    }
    return result;
}
 
开发者ID:GluuFederation,项目名称:oxAuth,代码行数:17,代码来源:RequestParameterService.java


示例6: getPermissionFromRPTByResourceId

import org.xdi.oxauth.model.util.Util; //导入依赖的package包/类
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;
}
 
开发者ID:GluuFederation,项目名称:oxAuth,代码行数:15,代码来源:UmaRptService.java


示例7: restoreLogoutParametersFromSession

import org.xdi.oxauth.model.util.Util; //导入依赖的package包/类
private boolean restoreLogoutParametersFromSession(SessionId sessionId) throws IllegalArgumentException, JsonParseException, JsonMappingException, IOException {
    if (sessionId == null) {
        return false;
    }

    this.sessionId = sessionId;
    Map<String, String> sessionAttributes = sessionId.getSessionAttributes();

    boolean restoreParameters = sessionAttributes.containsKey(EXTERNAL_LOGOUT);
    if (!restoreParameters) {
        return false;
    }

    String logoutParametersBase64 = sessionAttributes.get(EXTERNAL_LOGOUT_DATA);
    String logoutParametersJson = new String(Base64Util.base64urldecode(logoutParametersBase64), Util.UTF8_STRING_ENCODING);

    LogoutParameters logoutParameters = jsonService.jsonToObject(logoutParametersJson, LogoutParameters.class);

    this.idTokenHint = logoutParameters.getIdTokenHint();
    this.postLogoutRedirectUri = logoutParameters.getPostLogoutRedirectUri();

    return true;
}
 
开发者ID:GluuFederation,项目名称:oxAuth,代码行数:24,代码来源:LogoutAction.java


示例8: checkUiLocales

import org.xdi.oxauth.model.util.Util; //导入依赖的package包/类
public void checkUiLocales() {
    List<String> uiLocalesList = null;
    if (StringUtils.isNotBlank(uiLocales)) {
        uiLocalesList = Util.splittedStringAsList(uiLocales, " ");

        List<Locale> supportedLocales = new ArrayList<Locale>();
        for (Iterator<Locale> it = facesContext.getApplication().getSupportedLocales(); it.hasNext(); ) {
            supportedLocales.add(it.next());
        }
        Locale matchingLocale = LocaleUtil.localeMatch(uiLocalesList, supportedLocales);

        if (matchingLocale != null)
            languageBean.setLocaleCode(matchingLocale.getLanguage());
    } else {
        Locale defaultLocale = facesContext.getApplication().getDefaultLocale();
        if (defaultLocale != null) {
            languageBean.setLocaleCode(defaultLocale.getLanguage());
        }
    }
}
 
开发者ID:GluuFederation,项目名称:oxAuth,代码行数:21,代码来源:AuthorizeAction.java


示例9: getQueryString

import org.xdi.oxauth.model.util.Util; //导入依赖的package包/类
public String getQueryString() {
    StringBuilder sb = new StringBuilder();
    for (Map.Entry<String, String> entry : responseParameters.entrySet()) {
        if (sb.length() > 0) {
            sb.append('&');
        }
        try {
            sb.append(URLEncoder.encode(entry.getKey(), Util.UTF8_STRING_ENCODING));
            if (entry.getValue() != null) {
                sb.append('=').append(URLEncoder.encode(entry.getValue(), Util.UTF8_STRING_ENCODING));
            }
        } catch (UnsupportedEncodingException e) {
            e.printStackTrace();
        }
    }

    return sb.toString();
}
 
开发者ID:GluuFederation,项目名称:oxAuth,代码行数:19,代码来源:RedirectUri.java


示例10: PureJwt

import org.xdi.oxauth.model.util.Util; //导入依赖的package包/类
public PureJwt(String p_encodedHeader, String p_encodedPayload, String p_encodedSignature) {

        m_encodedHeader = p_encodedHeader;
        m_encodedPayload = p_encodedPayload;
        m_encodedSignature = p_encodedSignature;
        m_signingInput = m_encodedHeader + "." + m_encodedPayload;

        String decodedPayloadTemp = null;
        String decodedHeaderTemp = null;
        try {
            decodedHeaderTemp = new String(Base64Util.base64urldecode(p_encodedHeader), Util.UTF8_STRING_ENCODING);
            decodedPayloadTemp = new String(Base64Util.base64urldecode(p_encodedPayload), Util.UTF8_STRING_ENCODING);
        } catch (UnsupportedEncodingException e) {
            e.printStackTrace();
        }
        m_decodedHeader = decodedHeaderTemp;
        m_decodedPayload = decodedPayloadTemp;
    }
 
开发者ID:GluuFederation,项目名称:oxAuth,代码行数:19,代码来源:PureJwt.java


示例11: OxAuthCryptoProvider

import org.xdi.oxauth.model.util.Util; //导入依赖的package包/类
public OxAuthCryptoProvider(String keyStoreFile, String keyStoreSecret, String dnName) throws Exception {
    if (!Util.isNullOrEmpty(keyStoreFile) && !Util.isNullOrEmpty(keyStoreSecret) /* && !Util.isNullOrEmpty(dnName) */) {
        this.keyStoreFile = keyStoreFile;
        this.keyStoreSecret = keyStoreSecret;
        this.dnName = dnName;

        keyStore = KeyStore.getInstance("JKS");
        try {
            File f = new File(keyStoreFile);
            if (!f.exists()) {
                keyStore.load(null, keyStoreSecret.toCharArray());
                FileOutputStream fos = new FileOutputStream(keyStoreFile);
                keyStore.store(fos, keyStoreSecret.toCharArray());
                fos.close();
            }
            final InputStream is = new FileInputStream(keyStoreFile);
            keyStore.load(is, keyStoreSecret.toCharArray());
        } catch (Exception e) {
            LOG.error(e.getMessage(), e);
        }
    }
}
 
开发者ID:GluuFederation,项目名称:oxAuth,代码行数:23,代码来源:OxAuthCryptoProvider.java


示例12: sign

import org.xdi.oxauth.model.util.Util; //导入依赖的package包/类
@Override
public String sign(String signingInput, String alias, String sharedSecret, SignatureAlgorithm signatureAlgorithm) throws Exception {
    if (signatureAlgorithm == SignatureAlgorithm.NONE) {
        return "";
    } else if (SignatureAlgorithmFamily.HMAC.equals(signatureAlgorithm.getFamily())) {
        SecretKey secretKey = new SecretKeySpec(sharedSecret.getBytes(Util.UTF8_STRING_ENCODING), signatureAlgorithm.getAlgorithm());
        Mac mac = Mac.getInstance(signatureAlgorithm.getAlgorithm());
        mac.init(secretKey);
        byte[] sig = mac.doFinal(signingInput.getBytes());
        return Base64Util.base64urlencode(sig);
    } else { // EC or RSA
        PrivateKey privateKey = getPrivateKey(alias);

        Signature signature = Signature.getInstance(signatureAlgorithm.getAlgorithm(), "BC");
        //Signature signature = Signature.getInstance(signatureAlgorithm.getAlgorithm());
        signature.initSign(privateKey);
        signature.update(signingInput.getBytes());

        return Base64Util.base64urlencode(signature.sign());
    }
}
 
开发者ID:GluuFederation,项目名称:oxAuth,代码行数:22,代码来源:OxAuthCryptoProvider.java


示例13: getPublicKey

import org.xdi.oxauth.model.util.Util; //导入依赖的package包/类
public PublicKey getPublicKey(String alias) {
    PublicKey publicKey = null;

    try {
        if (Util.isNullOrEmpty(alias)) {
            return null;
        }

        java.security.cert.Certificate certificate = keyStore.getCertificate(alias);
        if (certificate == null) {
            return null;
        }
        publicKey = certificate.getPublicKey();
    } catch (KeyStoreException e) {
        e.printStackTrace();
    }

    return publicKey;
}
 
开发者ID:GluuFederation,项目名称:oxAuth,代码行数:20,代码来源:OxAuthCryptoProvider.java


示例14: getEncodedCredentials

import org.xdi.oxauth.model.util.Util; //导入依赖的package包/类
/**
 * 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;
}
 
开发者ID:GluuFederation,项目名称:oxAuth,代码行数:17,代码来源:BaseRequest.java


示例15: addReqParam

import org.xdi.oxauth.model.util.Util; //导入依赖的package包/类
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);
        }
    }
}
 
开发者ID:GluuFederation,项目名称:oxAuth,代码行数:10,代码来源:BaseClient.java


示例16: getQueryString

import org.xdi.oxauth.model.util.Util; //导入依赖的package包/类
/**
 * Returns a query string with the parameters of the end session request.
 * Any <code>null</code> or empty parameter will be omitted.
 *
 * @return A query string of parameters.
 */
@Override
public String getQueryString() {
    StringBuilder queryStringBuilder = new StringBuilder();

    try {
        if (StringUtils.isNotBlank(idTokenHint)) {
            queryStringBuilder.append(EndSessionRequestParam.ID_TOKEN_HINT)
                    .append("=")
                    .append(idTokenHint);
        }
        if (StringUtils.isNotBlank(postLogoutRedirectUri)) {
            queryStringBuilder.append("&")
                    .append(EndSessionRequestParam.POST_LOGOUT_REDIRECT_URI)
                    .append("=")
                    .append(URLEncoder.encode(postLogoutRedirectUri, Util.UTF8_STRING_ENCODING));
        }
        if (StringUtils.isNotBlank(state)) {
            queryStringBuilder.append("&")
                    .append(EndSessionRequestParam.STATE)
                    .append("=")
                    .append(URLEncoder.encode(state, Util.UTF8_STRING_ENCODING));
        }

        if (StringUtils.isNotBlank(sessionId)) {
            queryStringBuilder.append("&")
                    .append(EndSessionRequestParam.SESSION_ID)
                    .append("=")
                    .append(URLEncoder.encode(sessionId, Util.UTF8_STRING_ENCODING));
        }
    } catch (UnsupportedEncodingException e) {
        e.printStackTrace();
    }

    return queryStringBuilder.toString();
}
 
开发者ID:GluuFederation,项目名称:oxAuth,代码行数:42,代码来源:EndSessionRequest.java


示例17: requestRptAndGetNeedsInfo

import org.xdi.oxauth.model.util.Util; //导入依赖的package包/类
/**
 * RP requests RPT with ticket and gets needs_info error (not all claims are provided, so redirect to claims-gathering endpoint)
 */
@Test(dependsOnMethods = {"rsRegisterPermissions"})
@Parameters({"umaPatClientId", "umaPatClientSecret"})
public void requestRptAndGetNeedsInfo(String umaPatClientId, String umaPatClientSecret) throws Exception {
    showTitle("requestRptAndGetNeedsInfo");

    try {
        tokenService.requestRpt(
                "Basic " + encodeCredentials(umaPatClientId, umaPatClientSecret),
                GrantType.OXAUTH_UMA_TICKET.getValue(),
                permissionFlowTest.ticket,
                null, null, null, null, null);
    } catch (ClientResponseFailure ex) {
        // expected need_info error :
        // sample:  {"error":"need_info","ticket":"c024311b-f451-41db-95aa-cd405f16eed4","required_claims":[{"issuer":["https://localhost:8443"],"name":"country","claim_token_format":["http://openid.net/specs/openid-connect-core-1_0.html#IDToken"],"claim_type":"string","friendly_name":"country"},{"issuer":["https://localhost:8443"],"name":"city","claim_token_format":["http://openid.net/specs/openid-connect-core-1_0.html#IDToken"],"claim_type":"string","friendly_name":"city"}],"redirect_user":"https://localhost:8443/restv1/uma/gather_claimsgathering_id=sampleClaimsGathering&&?gathering_id=sampleClaimsGathering&&"}
        String entity = (String) ex.getResponse().getEntity(String.class);
        System.out.println(entity);

        assertEquals(ex.getResponse().getStatus(), Response.Status.FORBIDDEN.getStatusCode(), "Unexpected response status");

        needInfo = Util.createJsonMapper().readValue(entity, UmaNeedInfoResponse.class);
        assert_(needInfo);
        return;
    }

    throw new AssertionError("need_info error was not returned");
}
 
开发者ID:GluuFederation,项目名称:oxAuth,代码行数:30,代码来源:AccessProtectedResourceFlowHttpTest.java


示例18: requestRptAndGetNeedsInfo

import org.xdi.oxauth.model.util.Util; //导入依赖的package包/类
/**
 * RP requests RPT with ticket and gets needs_info error (not all claims are provided, so redirect to claims-gathering endpoint)
 */
@Test(dependsOnMethods = {"rsRegisterPermissions"})
public void requestRptAndGetNeedsInfo() throws Exception {
    showTitle("requestRptAndGetNeedsInfo");

    try {
        tokenService.requestRpt(
                "AccessToken " + userAccessToken,
                GrantType.OXAUTH_UMA_TICKET.getValue(),
                permissionFlowTest.ticket,
                null, null, null, null, null);
    } catch (ClientResponseFailure ex) {
        // expected need_info error :
        // sample:  {"error":"need_info","ticket":"c024311b-f451-41db-95aa-cd405f16eed4","required_claims":[{"issuer":["https://localhost:8443"],"name":"country","claim_token_format":["http://openid.net/specs/openid-connect-core-1_0.html#IDToken"],"claim_type":"string","friendly_name":"country"},{"issuer":["https://localhost:8443"],"name":"city","claim_token_format":["http://openid.net/specs/openid-connect-core-1_0.html#IDToken"],"claim_type":"string","friendly_name":"city"}],"redirect_user":"https://localhost:8443/restv1/uma/gather_claimsgathering_id=sampleClaimsGathering&&?gathering_id=sampleClaimsGathering&&"}
        String entity = (String) ex.getResponse().getEntity(String.class);
        System.out.println(entity);

        assertEquals(ex.getResponse().getStatus(), Response.Status.FORBIDDEN.getStatusCode(), "Unexpected response status");

        needInfo = Util.createJsonMapper().readValue(entity, UmaNeedInfoResponse.class);
        assert_(needInfo);
        return;
    }

    // Expected result is to get need_info error. It means that client was authenticated successfully.
    // If client fails to authenticate then we will get `401` invalid client error.
    throw new AssertionError("need_info error was not returned");
}
 
开发者ID:GluuFederation,项目名称:oxAuth,代码行数:31,代码来源:ClientAuthenticationByAccessTokenHttpTest.java


示例19: constructPage

import org.xdi.oxauth.model.util.Util; //导入依赖的package包/类
private String constructPage(Set<String> logoutUris, String postLogoutUrl, String state) {
    String iframes = "";
    for (String logoutUri : logoutUris) {
        iframes = iframes + String.format("<iframe height=\"0\" width=\"0\" src=\"%s\"></iframe>", logoutUri);
    }

    String html = "<!DOCTYPE html>" +
            "<html>" +
            "<head>";

    if (!Util.isNullOrEmpty(postLogoutUrl)) {

        if (!Util.isNullOrEmpty(state)) {
            if (postLogoutUrl.contains("?")) {
                postLogoutUrl += "&state=" + state;
            } else {
                postLogoutUrl += "?state=" + state;
            }
        }

        html += "<script>" +
                "window.onload=function() {" +
                "window.location='" + postLogoutUrl + "'" +
                "}" +
                "</script>";
    }

    html += "<title>Gluu Generated logout page</title>" +
            "</head>" +
            "<body>" +
            "Logout requests sent.<br/>" +
            iframes +
            "</body>" +
            "</html>";
    return html;
}
 
开发者ID:GluuFederation,项目名称:oxAuth,代码行数:37,代码来源:EndSessionRestWebServiceImpl.java


示例20: validateLogoutUri

import org.xdi.oxauth.model.util.Util; //导入依赖的package包/类
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);
    }
}
 
开发者ID:GluuFederation,项目名称:oxAuth,代码行数:33,代码来源:RegisterParamsValidator.java



注:本文中的org.xdi.oxauth.model.util.Util类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java AlgoApriori类代码示例发布时间:2022-05-15
下一篇:
Java Entry类代码示例发布时间:2022-05-15
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap