当前位置: 首页>>代码示例>>Java>>正文


Java Issuer类代码示例

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


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

示例1: tokenEndpoint

import com.nimbusds.oauth2.sdk.id.Issuer; //导入依赖的package包/类
@Bean
public TokenEndpoint tokenEndpoint() {
	AuthorizationCodeGrantHandler authorizationCodeGrantHandler = new AuthorizationCodeGrantHandler(
			clientRepository(), tokenService(), authorizationCodeService());
	ResourceOwnerPasswordCredentialsGrantHandler passwordCredentialsGrantHandler = new ResourceOwnerPasswordCredentialsGrantHandler(
			clientRepository(), tokenService(), scopeResolver(), authenticationHandler());
	ClientCredentialsGrantHandler clientCredentialsGrantHandler = new ClientCredentialsGrantHandler(
			clientRepository(), scopeResolver(), tokenService());
	RefreshTokenGrantHandler refreshTokenGrantHandler = new RefreshTokenGrantHandler(clientRepository(),
			tokenService(), refreshTokenStore());

	Map<Class<?>, GrantHandler> grantHandlers = new HashMap<>();
	grantHandlers.put(AuthorizationCodeGrant.class, authorizationCodeGrantHandler);
	grantHandlers.put(ResourceOwnerPasswordCredentialsGrant.class, passwordCredentialsGrantHandler);
	grantHandlers.put(ClientCredentialsGrant.class, clientCredentialsGrantHandler);
	grantHandlers.put(RefreshTokenGrant.class, refreshTokenGrantHandler);

	return new TokenEndpoint(grantHandlers, new Issuer("http://example.com"), clientRepository());
}
 
开发者ID:vpavic,项目名称:simple-openid-provider,代码行数:20,代码来源:TokenEndpointTests.java

示例2: validate

import com.nimbusds.oauth2.sdk.id.Issuer; //导入依赖的package包/类
@Override
public IDTokenClaimsSet validate(final JWT idToken, final Nonce expectedNonce) throws BadJOSEException, JOSEException {
    try {
        if (originalIssuer.contains("%7Btenantid%7D")) {
            Object tid = idToken.getJWTClaimsSet().getClaim("tid");
            if (tid == null) {
                throw new BadJWTException("ID token does not contain the 'tid' claim");
            }
            base = new IDTokenValidator(new Issuer(originalIssuer.replace("%7Btenantid%7D", tid.toString())),
                    base.getClientID(), base.getJWSKeySelector(), base.getJWEKeySelector());
            base.setMaxClockSkew(getMaxClockSkew());
        }
    } catch (ParseException e) {
        throw new BadJWTException(e.getMessage(), e);
    }
    return base.validate(idToken, expectedNonce);
}
 
开发者ID:yaochi,项目名称:pac4j-plus,代码行数:18,代码来源:AzureAdIdTokenValidator.java

示例3: handle

import com.nimbusds.oauth2.sdk.id.Issuer; //导入依赖的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

示例4: testSuccess

import com.nimbusds.oauth2.sdk.id.Issuer; //导入依赖的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

示例5: testDynamic

import com.nimbusds.oauth2.sdk.id.Issuer; //导入依赖的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

示例6: testSetters

import com.nimbusds.oauth2.sdk.id.Issuer; //导入依赖的package包/类
@Test
public void testSetters() throws URISyntaxException, ParseException {
    ctx.setAcr("acrValue");
    ctx.setAuthTime(1);
    ctx.setExp(2);
    Issuer issuer = new Issuer("iss");
    Subject sub = new Subject("sub");
    List<Audience> aud = new ArrayList<Audience>();
    aud.add(new Audience("aud"));
    IDTokenClaimsSet token = new IDTokenClaimsSet(issuer, sub, aud, new Date(), new Date());
    ctx.setIDToken(token);
    NameID id = new MockNameID();
    ctx.setNameId(id);
    URI uri = new URI("https://example.org");
    ctx.setRedirectURI(uri);
    ctx.setRequestedSubject("sub");
    Scope scope = new Scope();
    ctx.setScope(scope);
    JWSHeader header = new JWSHeader(JWSAlgorithm.ES256);
    SignedJWT sJWT = new SignedJWT(header, token.toJWTClaimsSet());
    ctx.setSignedIDToken(sJWT);
    Assert.assertEquals(ctx.getAcr().toString(), "acrValue");
    ctx.setAcr(null);
    Assert.assertNull(ctx.getAcr());
    Assert.assertEquals(ctx.getAuthTime(), new Date(1));
    Assert.assertEquals(ctx.getExp(), new Date(2));
    Assert.assertEquals(ctx.getIDToken(), token);
    Assert.assertEquals(ctx.getNameId(), id);
    Assert.assertEquals(ctx.getSignedIDToken(), sJWT);
    Assert.assertEquals(ctx.getRedirectURI(), uri);
    Assert.assertEquals(ctx.getRequestedSubject(), "sub");
    Assert.assertEquals(ctx.getScope(), scope);
}
 
开发者ID:CSCfi,项目名称:shibboleth-idp-oidc-extension,代码行数:34,代码来源:OIDCAuthenticationResponseContextTest.java

示例7: DefaultTokenService

import com.nimbusds.oauth2.sdk.id.Issuer; //导入依赖的package包/类
public DefaultTokenService(Issuer issuer, JwkSetLoader jwkSetLoader, ClaimSource claimSource,
		RefreshTokenStore refreshTokenStore) {
	Objects.requireNonNull(issuer, "issuer must not be null");
	Objects.requireNonNull(jwkSetLoader, "jwkSetLoader must not be null");
	Objects.requireNonNull(claimSource, "claimSource must not be null");
	Objects.requireNonNull(refreshTokenStore, "refreshTokenStore must not be null");
	this.issuer = issuer;
	this.jwkSetLoader = jwkSetLoader;
	this.claimSource = claimSource;
	this.refreshTokenStore = refreshTokenStore;
}
 
开发者ID:vpavic,项目名称:simple-openid-provider,代码行数:12,代码来源:DefaultTokenService.java

示例8: TokenRevocationEndpoint

import com.nimbusds.oauth2.sdk.id.Issuer; //导入依赖的package包/类
public TokenRevocationEndpoint(Issuer issuer, ClientRepository clientRepository,
		RefreshTokenStore refreshTokenStore) {
	Objects.requireNonNull(issuer, "issuer must not be null");
	Objects.requireNonNull(clientRepository, "clientRepository must not be null");
	Objects.requireNonNull(refreshTokenStore, "refreshTokenStore must not be null");
	this.refreshTokenStore = refreshTokenStore;
	this.clientRequestValidator = new ClientRequestValidator(issuer, clientRepository);
}
 
开发者ID:vpavic,项目名称:simple-openid-provider,代码行数:9,代码来源:TokenRevocationEndpoint.java

示例9: TokenEndpoint

import com.nimbusds.oauth2.sdk.id.Issuer; //导入依赖的package包/类
public TokenEndpoint(Map<Class<?>, GrantHandler> grantHandlers, Issuer issuer, ClientRepository clientRepository) {
	Objects.requireNonNull(grantHandlers, "grantHandlers must not be null");
	Objects.requireNonNull(issuer, "issuer must not be null");
	Objects.requireNonNull(clientRepository, "clientRepository must not be null");
	if (grantHandlers.isEmpty()) {
		throw new IllegalArgumentException("grantHandlers must not be empty");
	}
	this.grantHandlers = grantHandlers;
	this.clientRequestValidator = new ClientRequestValidator(issuer, clientRepository);
}
 
开发者ID:vpavic,项目名称:simple-openid-provider,代码行数:11,代码来源:TokenEndpoint.java

示例10: getMetadataIssuer

import com.nimbusds.oauth2.sdk.id.Issuer; //导入依赖的package包/类
protected Issuer getMetadataIssuer() {
	Issuer issuer;
	if (params.getBool(FORCE_HONEST_DISCOVERY_ISS)) {
		issuer = getHonestIssuer();
	} else {
		issuer = supplyHonestOrEvil(this::getHonestIssuer, this::getEvilIssuer);
	}
	return issuer;
}
 
开发者ID:RUB-NDS,项目名称:PrOfESSOS,代码行数:10,代码来源:AbstractOPImplementation.java

示例11: getTokenIssuer

import com.nimbusds.oauth2.sdk.id.Issuer; //导入依赖的package包/类
protected Issuer getTokenIssuer() {
	Issuer issuer;
	if (params.getBool(FORCE_HONEST_TOKEN_ISS)) {
		issuer = getHonestIssuer();
	} else {
		issuer = supplyHonestOrEvil(this::getHonestIssuer, this::getEvilIssuer);
	}
	return issuer;
}
 
开发者ID:RUB-NDS,项目名称:PrOfESSOS,代码行数:10,代码来源:AbstractOPImplementation.java

示例12: getDefaultOPMetadata

import com.nimbusds.oauth2.sdk.id.Issuer; //导入依赖的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

示例13: OIDCIdentityProvider

import com.nimbusds.oauth2.sdk.id.Issuer; //导入依赖的package包/类
public OIDCIdentityProvider(IdentityProvider provider, Issuer issuer, URI authURI, URI tokenURI, URI userInfoURI, IDTokenValidator rsaValidator, IDTokenValidator hmacValidator) {
	this.clientId = new ClientID(provider.getClientId());
	this.clientSecret = provider.getClientSecret();
	this.responseType = provider.getResponseType();
	this.scope = provider.getScope();
	this.clockSkew = provider.getClockSkew();
	this.checkNonce = provider.isCheckNonce();
	this.claims = parseClaimsRequest(provider.getClaims());
	this.issuer = issuer;
	this.authURI = authURI;
	this.tokenURI = tokenURI;
	this.userInfoURI = userInfoURI;
	this.rsaValidator = rsaValidator;
	this.hmacValidator = hmacValidator;
}
 
开发者ID:aaronanderson,项目名称:swarm-oidc,代码行数:16,代码来源:OIDCAuthenticationMechanism.java

示例14: validateToken

import com.nimbusds.oauth2.sdk.id.Issuer; //导入依赖的package包/类
private IDTokenClaimsSet validateToken(OAuthProvider provider, OAuthLoginRequestDTO oAuthLoginRequestDTO) throws MalformedURLException, ParseException, BadJOSEException, JOSEException {
    Issuer iss = new Issuer(provider.getIssuer());
    ClientID clientID = new ClientID(provider.getClientID());
    Nonce nonce = new Nonce(oAuthLoginRequestDTO.getNonce());
    URL jwkSetURL = new URL(provider.getJwkSetURL());
    JWSAlgorithm jwsAlg = JWSAlgorithm.parse(provider.getJwsAlgorithm());
    IDTokenValidator validator = new IDTokenValidator(iss, clientID, jwsAlg, jwkSetURL);
    JWT idToken = JWTParser.parse(oAuthLoginRequestDTO.getIdToken());
    return validator.validate(idToken, nonce);
}
 
开发者ID:polarsys,项目名称:eplmp,代码行数:11,代码来源:AuthResource.java

示例15: getIssuer

import com.nimbusds.oauth2.sdk.id.Issuer; //导入依赖的package包/类
/**
 * @return the issuer
 * @throws MalformedURLException when failing to create the issuer
 */
public Issuer getIssuer() throws MalformedURLException
{
    XWikiContext xcontext = this.xcontextProvider.get();

    XWikiURLFactory urlFactory = xcontext.getURLFactory();

    return new Issuer(urlFactory.getServerURL(xcontext).toString());
}
 
开发者ID:xwiki-contrib,项目名称:oidc,代码行数:13,代码来源:OIDCManager.java


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