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

Java OIDCProviderMetadata类代码示例

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

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



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

示例1: parse

import com.nimbusds.openid.connect.sdk.op.OIDCProviderMetadata; //导入依赖的package包/类
/** {@inheritDoc} */
@Override
protected OIDCProviderMetadata parse(byte[] bytes) throws ParseException {
    final OIDCProviderMetadata result = OIDCProviderMetadata.parse(JSONObjectUtils.parse(new String(bytes)));
    final JSONObject jsonResult = result.toJSONObject();
    for (final String key : dynamicResolvers.keySet()) {
        log.debug("Starting to resolve value for {}", key);
        final RefreshableMetadataValueResolver resolver = dynamicResolvers.get(key);
        try {
            resolver.refresh();
            final Object value = resolver.resolveSingle(null);
            if (value != null) {
                jsonResult.put(key, value);
                log.debug("The field {} updated to the result", key);
            }
        } catch (ResolverException e) {
            log.warn("Could not resolve a value for {̛}, ignoring it.", key, e);
        }
    }
    return OIDCProviderMetadata.parse(jsonResult);
}
 
开发者ID:CSCfi,项目名称:shibboleth-idp-oidc-extension,代码行数:22,代码来源:DynamicFilesystemProviderMetadataResolver.java


示例2: retrieveProviderMetadata

import com.nimbusds.openid.connect.sdk.op.OIDCProviderMetadata; //导入依赖的package包/类
/**
	 * Retrieve provider metadata.
	 * Provider configuration information
	 * Obtaining the provider configuration information can be done either out-of-band or using the optional discovery process:
	 *
	 * @throws IOException Signals that an I/O exception has occurred.
	 * @throws ParseException the parse exception
	 * @throws KeyStoreException
	 * @throws CertificateException
	 * @throws NoSuchAlgorithmException
	 * @throws KeyManagementException
	 */
	public void retrieveProviderMetadata() throws IOException, ParseException, KeyManagementException, NoSuchAlgorithmException, CertificateException, KeyStoreException {
		
		URL providerConfigurationURL = issuerURI.resolve(URLPATH_WELL_KNOWN_OPENID).toURL();
//		System.out.println(providerConfigurationURL);
		URLConnection conn = providerConfigurationURL.openConnection();

		if (trustStoreFile != null) {
			Trust.trustSpecific((HttpsURLConnection) conn, trustStoreFile);
		}
		InputStream stream = conn.getInputStream();
		// Read all data from URL
		String providerInfo = null;
		try (java.util.Scanner s = new java.util.Scanner(stream)) {
			providerInfo = s.useDelimiter("\\A").hasNext() ? s.next() : "";
		}
		setProviderMetadata(OIDCProviderMetadata.parse(providerInfo));
	}
 
开发者ID:EnFlexIT,项目名称:AgentWorkbench,代码行数:30,代码来源:SimpleOIDCClient.java


示例3: providerConfiguration

import com.nimbusds.openid.connect.sdk.op.OIDCProviderMetadata; //导入依赖的package包/类
@Override
public void providerConfiguration(RequestPath path, HttpServletRequest req, HttpServletResponse resp) throws IOException {
	logger.log("Provider configuration requested.");
	logger.logHttpRequest(req, null);
	try {
		OIDCProviderMetadata md = getDefaultOPMetadata();
		String mdStr = md.toJSONObject().toString();

		resp.setContentType("application/json");
		resp.getWriter().write(mdStr);

		resp.flushBuffer();
		logger.log("Returning default provider config.");
		logger.logHttpResponse(resp, mdStr);
	} catch (IOException | ParseException ex) {
		logger.log("Failed to process default provider config.", ex);
		resp.sendError(HttpServletResponse.SC_INTERNAL_SERVER_ERROR);
		resp.flushBuffer();
		logger.logHttpResponse(resp, null);
	}
}
 
开发者ID:RUB-NDS,项目名称:PrOfESSOS,代码行数:22,代码来源:DefaultOP.java


示例4: handle

import com.nimbusds.openid.connect.sdk.op.OIDCProviderMetadata; //导入依赖的package包/类
@Override
public Response handle(HTTPRequest httpRequest, OIDCResourceReference reference) throws Exception
{
    Issuer issuer = this.manager.getIssuer();
    List<SubjectType> subjectTypes = Arrays.asList(SubjectType.PUBLIC);
    URI jwkSetURI = this.manager.createEndPointURI(JWKOIDCEndpoint.HINT);

    OIDCProviderMetadata metadata = new OIDCProviderMetadata(issuer, subjectTypes, jwkSetURI);

    metadata.setAuthorizationEndpointURI(this.manager.createEndPointURI(AuthorizationOIDCEndpoint.HINT));
    metadata.setTokenEndpointURI(this.manager.createEndPointURI(TokenOIDCEndpoint.HINT));
    metadata.setUserInfoEndpointURI(this.manager.createEndPointURI(UserInfoOIDCEndpoint.HINT));

    return new ContentResponse(CommonContentTypes.APPLICATION_JSON, metadata.toJSONObject().toString(),
        HTTPResponse.SC_OK);
}
 
开发者ID:xwiki-contrib,项目名称:oidc,代码行数:17,代码来源:ConfigurationOIDCEnpoint.java


示例5: resolve

import com.nimbusds.openid.connect.sdk.op.OIDCProviderMetadata; //导入依赖的package包/类
/** {@inheritDoc} */
@Override
public Iterable<OIDCProviderMetadata> resolve(CriteriaSet criteria) throws ResolverException {
    ComponentSupport.ifNotInitializedThrowUninitializedComponentException(this);
    ComponentSupport.ifDestroyedThrowDestroyedComponentException(this);

    final IssuerCriterion issuerCriterion = criteria.get(IssuerCriterion.class);
    if (issuerCriterion == null || issuerCriterion.getIssuer() == null) {
        log.trace("No issuer criteria found, returning all");
        return getBackingStore().getOrderedInformation();
    }
    // TODO: support other criterion
    return lookupIdentifier(issuerCriterion.getIssuer());
}
 
开发者ID:CSCfi,项目名称:shibboleth-idp-oidc-extension,代码行数:15,代码来源:FilesystemProviderMetadataResolver.java


示例6: resolveSingle

import com.nimbusds.openid.connect.sdk.op.OIDCProviderMetadata; //导入依赖的package包/类
/** {@inheritDoc} */
@Override
public OIDCProviderMetadata resolveSingle(CriteriaSet criteria) throws ResolverException {
    final Iterable<OIDCProviderMetadata> iterable = resolve(criteria);
    if (iterable != null) {
        final Iterator<OIDCProviderMetadata> iterator = iterable.iterator();
        if (iterator != null && iterator.hasNext()) {
            return iterator.next();
        }
    }
    log.warn("Could not find any clients with the given criteria");
    return null;
}
 
开发者ID:CSCfi,项目名称:shibboleth-idp-oidc-extension,代码行数:14,代码来源:FilesystemProviderMetadataResolver.java


示例7: testSuccess

import com.nimbusds.openid.connect.sdk.op.OIDCProviderMetadata; //导入依赖的package包/类
@Test
public void testSuccess() throws Exception {
    final IssuerCriterion criterion = new IssuerCriterion(new Issuer(issuer));
    final OIDCProviderMetadata metadata = resolver.resolveSingle(new CriteriaSet(criterion));
    Assert.assertNotNull(metadata);
    Assert.assertEquals(metadata.getIssuer().getValue(), issuer);
}
 
开发者ID:CSCfi,项目名称:shibboleth-idp-oidc-extension,代码行数:8,代码来源:FilesystemProviderMetdataResolverTest.java


示例8: testDynamic

import com.nimbusds.openid.connect.sdk.op.OIDCProviderMetadata; //导入依赖的package包/类
@Test
public void testDynamic() throws Exception {
    final IssuerCriterion criterion = new IssuerCriterion(new Issuer(issuer));
    OIDCProviderMetadata metadata = resolver.resolveSingle(new CriteriaSet(criterion));
    Assert.assertNotNull(metadata);
    Assert.assertEquals(metadata.getIssuer().getValue(), issuer);
    ((DynamicFilesystemProviderMetadataResolver)resolver).refresh();
    metadata = resolver.resolveSingle(new CriteriaSet(criterion));
    Assert.assertNotNull(metadata.getCustomParameter(name));
    Assert.assertEquals(metadata.getCustomParameter(name), value);
}
 
开发者ID:CSCfi,项目名称:shibboleth-idp-oidc-extension,代码行数:12,代码来源:DynamicFilesystemProviderMetadataResolverTest.java


示例9: resolve

import com.nimbusds.openid.connect.sdk.op.OIDCProviderMetadata; //导入依赖的package包/类
/** {@inheritDoc} */
@Override
@Nonnull
public Iterable<OIDCProviderMetadata> resolve(@Nullable final CriteriaSet criteria) throws ResolverException {

    return resolver.resolve(criteria);
}
 
开发者ID:CSCfi,项目名称:shibboleth-idp-oidc-extension,代码行数:8,代码来源:ServiceableProviderMetadataProvider.java


示例10: resolveSingle

import com.nimbusds.openid.connect.sdk.op.OIDCProviderMetadata; //导入依赖的package包/类
/** {@inheritDoc} */
@Override
@Nullable
public OIDCProviderMetadata resolveSingle(@Nullable final CriteriaSet criteria) throws ResolverException {

    return resolver.resolveSingle(criteria);
}
 
开发者ID:CSCfi,项目名称:shibboleth-idp-oidc-extension,代码行数:8,代码来源:ServiceableProviderMetadataProvider.java


示例11: getDefaultOPMetadata

import com.nimbusds.openid.connect.sdk.op.OIDCProviderMetadata; //导入依赖的package包/类
protected OIDCProviderMetadata getDefaultOPMetadata() throws ParseException {
	Issuer issuer = getMetadataIssuer();
	List<SubjectType> subjectTypes = Arrays.asList(SubjectType.PUBLIC);
	URI jwksUri = UriBuilder.fromUri(baseUri).path(JWKS_PATH).build();
	OIDCProviderMetadata md = new OIDCProviderMetadata(issuer, subjectTypes, jwksUri);
	md.applyDefaults();

	// endpoints
	URI authzEndpt = getMetadataAuthorizationEndpoint();
	URI tokenEndpt = getMetadataTokenEndpoint();
	URI userInfoEndpt = getMetadataUserinfoEndpoint();
	URI registrationEndpt = getMetadataRegistrationEndpoint();
	md.setAuthorizationEndpointURI(authzEndpt);
	md.setTokenEndpointURI(tokenEndpt);
	md.setUserInfoEndpointURI(userInfoEndpt);
	md.setRegistrationEndpointURI(registrationEndpt);

	// , ResponseType.parse("id_token"), ResponseType.parse("token id_token"));
	Scope scopes = new Scope("openid");
	List<ResponseType> responseTypes = Arrays.asList(ResponseType.parse("code"), ResponseType.parse("id_token"),
			ResponseType.parse("token id_token"));
	List<ResponseMode> responseModes = Arrays.asList(ResponseMode.QUERY, ResponseMode.FRAGMENT, ResponseMode.FORM_POST);
	List<GrantType> grantTypes = Arrays.asList(GrantType.AUTHORIZATION_CODE, GrantType.IMPLICIT);
	md.setScopes(scopes);
	md.setResponseTypes(responseTypes);
	md.setResponseModes(responseModes);
	md.setGrantTypes(grantTypes);

	// algorithms
	List<JWSAlgorithm> jwsAlgs = Arrays.asList(JWSAlgorithm.RS256, JWSAlgorithm.parse("none"));
	md.setIDTokenJWSAlgs(jwsAlgs);

	List<ClientAuthenticationMethod> authMethods = Arrays.asList(ClientAuthenticationMethod.CLIENT_SECRET_BASIC);
	md.setTokenEndpointAuthMethods(authMethods);

	List<Display> displays = Arrays.asList(Display.PAGE);
	md.setDisplays(displays);

	return md;
}
 
开发者ID:RUB-NDS,项目名称:PrOfESSOS,代码行数:41,代码来源:AbstractOPImplementation.java


示例12: parse

import com.nimbusds.openid.connect.sdk.op.OIDCProviderMetadata; //导入依赖的package包/类
/** {@inheritDoc} */
@Override
protected OIDCProviderMetadata parse(byte[] bytes) throws ParseException {
    return OIDCProviderMetadata.parse(JSONObjectUtils.parse(new String(bytes)));
}
 
开发者ID:CSCfi,项目名称:shibboleth-idp-oidc-extension,代码行数:6,代码来源:FilesystemProviderMetadataResolver.java


示例13: getKey

import com.nimbusds.openid.connect.sdk.op.OIDCProviderMetadata; //导入依赖的package包/类
/** {@inheritDoc} */
@Override
protected Issuer getKey(OIDCProviderMetadata value) {
    return value.getIssuer();
}
 
开发者ID:CSCfi,项目名称:shibboleth-idp-oidc-extension,代码行数:6,代码来源:FilesystemProviderMetadataResolver.java


示例14: testNotFound

import com.nimbusds.openid.connect.sdk.op.OIDCProviderMetadata; //导入依赖的package包/类
@Test
public void testNotFound() throws Exception {
    final IssuerCriterion criterion = new IssuerCriterion(new Issuer("not_found"));
    final OIDCProviderMetadata metadata = resolver.resolveSingle(new CriteriaSet(criterion));
    Assert.assertNull(metadata);
}
 
开发者ID:CSCfi,项目名称:shibboleth-idp-oidc-extension,代码行数:7,代码来源:FilesystemProviderMetdataResolverTest.java


示例15: setProviderMetadata

import com.nimbusds.openid.connect.sdk.op.OIDCProviderMetadata; //导入依赖的package包/类
/**
 * Sets the provider metadata by object.
 *
 * @param providerMetadata the new provider metadata
 */
void setProviderMetadata(OIDCProviderMetadata providerMetadata) {
	this.providerMetadata = providerMetadata;
	authorizationEndpointURI = providerMetadata.getAuthorizationEndpointURI();
	userInfoEndpointURI = providerMetadata.getUserInfoEndpointURI();
}
 
开发者ID:EnFlexIT,项目名称:AgentWorkbench,代码行数:11,代码来源:SimpleOIDCClient.java


示例16: DiscoveryEndpoint

import com.nimbusds.openid.connect.sdk.op.OIDCProviderMetadata; //导入依赖的package包/类
public DiscoveryEndpoint(OIDCProviderMetadata providerMetadata) {
	Objects.requireNonNull(providerMetadata, "providerMetadata must not be null");
	this.providerMetadata = providerMetadata;
}
 
开发者ID:vpavic,项目名称:simple-openid-provider,代码行数:5,代码来源:DiscoveryEndpoint.java


示例17: discoveryEndpoint

import com.nimbusds.openid.connect.sdk.op.OIDCProviderMetadata; //导入依赖的package包/类
@Bean
public DiscoveryEndpoint discoveryEndpoint() {
	return new DiscoveryEndpoint(new OIDCProviderMetadata(new Issuer("http://example.com"),
			Collections.singletonList(SubjectType.PUBLIC), URI.create("http://example.com/jwks.json")));
}
 
开发者ID:vpavic,项目名称:simple-openid-provider,代码行数:6,代码来源:DiscoveryEndpointTests.java


示例18: getProviderMetadata

import com.nimbusds.openid.connect.sdk.op.OIDCProviderMetadata; //导入依赖的package包/类
public OIDCProviderMetadata getProviderMetadata() {
    return this.providerMetadata;
}
 
开发者ID:yaochi,项目名称:pac4j-plus,代码行数:4,代码来源:OidcConfiguration.java


示例19: setProviderMetadata

import com.nimbusds.openid.connect.sdk.op.OIDCProviderMetadata; //导入依赖的package包/类
public void setProviderMetadata(final OIDCProviderMetadata providerMetadata) {
    this.providerMetadata = providerMetadata;
}
 
开发者ID:yaochi,项目名称:pac4j-plus,代码行数:4,代码来源:OidcConfiguration.java



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

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

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

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

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

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