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


Java Scope.Value方法代码示例

本文整理汇总了Java中com.nimbusds.oauth2.sdk.Scope.Value方法的典型用法代码示例。如果您正苦于以下问题:Java Scope.Value方法的具体用法?Java Scope.Value怎么用?Java Scope.Value使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在com.nimbusds.oauth2.sdk.Scope的用法示例。


在下文中一共展示了Scope.Value方法的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: doExecute

import com.nimbusds.oauth2.sdk.Scope; //导入方法依赖的package包/类
/** {@inheritDoc} */
@Override
protected void doExecute(@Nonnull final ProfileRequestContext profileRequestContext) {
    Scope registeredScopes = getMetadataContext().getClientInformation().getMetadata().getScope();
    if (registeredScopes == null || registeredScopes.isEmpty()) {
        log.debug("{} No registered scopes for client {}, nothing to do", getLogPrefix(),
                getMetadataContext().getClientInformation().getID());
        return;
    }
    Scope requestedScopes = scopeLookupStrategy.apply(profileRequestContext);
    for (Iterator<Scope.Value> i = requestedScopes.iterator(); i.hasNext();) {
        Scope.Value scope = i.next();
        if (!registeredScopes.contains(scope)) {
            log.warn("{} removing requested scope {} for rp {} as it is not a registered one", getLogPrefix(),
                    scope.getValue(), getMetadataContext().getClientInformation().getID());
            i.remove();
        }
    }
    getOidcResponseContext().setScope(requestedScopes);
}
 
开发者ID:CSCfi,项目名称:shibboleth-idp-oidc-extension,代码行数:21,代码来源:ValidateScope.java

示例2: getSupportedScopes

import com.nimbusds.oauth2.sdk.Scope; //导入方法依赖的package包/类
public List<Scope.Value> getSupportedScopes() {
	List<Scope.Value> supportedScopes = new ArrayList<>();
	supportedScopes.addAll(this.openidScopes);
	supportedScopes.addAll(this.resourceScopes.keySet());

	return supportedScopes;
}
 
开发者ID:vpavic,项目名称:simple-openid-provider,代码行数:8,代码来源:OpenIdProviderProperties.java

示例3: read

import com.nimbusds.oauth2.sdk.Scope; //导入方法依赖的package包/类
@Override
public Scope.Value read(final Kryo kryo, final Input input, final Class<Scope.Value> aClass) {
    final String value = this.stringSerializer.read(kryo, input, String.class);
    final String requirement = this.stringSerializer.read(kryo, input, String.class);
    if (requirement == null) {
        return new Scope.Value(value);
    } else {
        return new Scope.Value(value, Scope.Value.Requirement.valueOf(requirement));
    }
}
 
开发者ID:yaochi,项目名称:pac4j-plus,代码行数:11,代码来源:ScopeValueSerializer.java

示例4: write

import com.nimbusds.oauth2.sdk.Scope; //导入方法依赖的package包/类
@Override
public void write(final Kryo kryo, final Output output, final Scope.Value value) {
    final String v = value.getValue();
    String r = null;
    final Scope.Value.Requirement requirement = value.getRequirement();
    if (requirement != null) {
        r = requirement.name();
    }
    this.stringSerializer.write(kryo, output, v);
    this.stringSerializer.write(kryo, output, r);
}
 
开发者ID:yaochi,项目名称:pac4j-plus,代码行数:12,代码来源:ScopeValueSerializer.java

示例5: createAccessToken

import com.nimbusds.oauth2.sdk.Scope; //导入方法依赖的package包/类
@Override
public AccessToken createAccessToken(AccessTokenRequest accessTokenRequest) {
	Instant now = Instant.now();

	Subject subject = accessTokenRequest.getSubject();
	OIDCClientInformation client = accessTokenRequest.getClient();
	Scope scope = accessTokenRequest.getScope();

	Set<Audience> audiences = new LinkedHashSet<>();
	audiences.add(new Audience(this.issuer));

	for (Scope.Value value : scope) {
		String resource = this.resourceScopes.get(value);

		if (resource != null) {
			audiences.add(new Audience(resource));
		}
	}

	Date expirationTime = Date.from(now.plus(this.accessTokenLifetime));
	Date issueTime = Date.from(now);
	JWTID jwtId = new JWTID(UUID.randomUUID().toString());
	UserInfo userInfo = this.claimSource.load(subject, new HashSet<>(this.accessTokenSubjectClaims));
	userInfo.setClaim(this.accessTokenScopeClaim, scope);
	userInfo.setClaim(this.accessTokenClientIdClaim, client.getID());

	try {
		JWTAssertionDetails details = new JWTAssertionDetails(this.issuer, userInfo.getSubject(),
				new ArrayList<>(audiences), expirationTime, issueTime, issueTime, jwtId, userInfo.toJSONObject());
		SignedJWT accessToken;

		if (JWSAlgorithm.Family.HMAC_SHA.contains(this.accessTokenJwsAlgorithm)) {
			Secret secret = client.getSecret();

			accessToken = JWTAssertionFactory.create(details, this.accessTokenJwsAlgorithm, secret);
		}
		else if (JWSAlgorithm.Family.RSA.contains(this.accessTokenJwsAlgorithm)) {
			RSAKey rsaKey = (RSAKey) resolveJwk(this.accessTokenJwsAlgorithm);

			accessToken = JWTAssertionFactory.create(details, this.accessTokenJwsAlgorithm,
					rsaKey.toRSAPrivateKey(), rsaKey.getKeyID(), jcaProvider);
		}
		else if (JWSAlgorithm.Family.EC.contains(this.accessTokenJwsAlgorithm)) {
			ECKey ecKey = (ECKey) resolveJwk(this.accessTokenJwsAlgorithm);

			accessToken = JWTAssertionFactory.create(details, this.accessTokenJwsAlgorithm, ecKey.toECPrivateKey(),
					ecKey.getKeyID(), jcaProvider);
		}
		else {
			throw new KeyException("Unsupported algorithm: " + this.accessTokenJwsAlgorithm);
		}

		return new BearerAccessToken(accessToken.serialize(), this.accessTokenLifetime.getSeconds(), scope);
	}
	catch (JOSEException e) {
		throw new RuntimeException(e);
	}
}
 
开发者ID:vpavic,项目名称:simple-openid-provider,代码行数:59,代码来源:DefaultTokenService.java

示例6: setResourceScopes

import com.nimbusds.oauth2.sdk.Scope; //导入方法依赖的package包/类
public void setResourceScopes(Map<Scope.Value, String> resourceScopes) {
	this.resourceScopes = resourceScopes;
}
 
开发者ID:vpavic,项目名称:simple-openid-provider,代码行数:4,代码来源:DefaultTokenService.java

示例7: setScopeClaims

import com.nimbusds.oauth2.sdk.Scope; //导入方法依赖的package包/类
public void setScopeClaims(Map<Scope.Value, List<String>> scopeClaims) {
	this.scopeClaims = scopeClaims;
}
 
开发者ID:vpavic,项目名称:simple-openid-provider,代码行数:4,代码来源:DefaultTokenService.java

示例8: setSupportedScopes

import com.nimbusds.oauth2.sdk.Scope; //导入方法依赖的package包/类
public void setSupportedScopes(List<Scope.Value> supportedScopes) {
	this.supportedScopes = supportedScopes;
}
 
开发者ID:vpavic,项目名称:simple-openid-provider,代码行数:4,代码来源:DefaultScopeResolver.java

示例9: getOpenidScopes

import com.nimbusds.oauth2.sdk.Scope; //导入方法依赖的package包/类
public List<Scope.Value> getOpenidScopes() {
	return this.openidScopes;
}
 
开发者ID:vpavic,项目名称:simple-openid-provider,代码行数:4,代码来源:OpenIdProviderProperties.java

示例10: setOpenidScopes

import com.nimbusds.oauth2.sdk.Scope; //导入方法依赖的package包/类
public void setOpenidScopes(List<Scope.Value> openidScopes) {
	this.openidScopes = openidScopes;
}
 
开发者ID:vpavic,项目名称:simple-openid-provider,代码行数:4,代码来源:OpenIdProviderProperties.java

示例11: getResourceScopes

import com.nimbusds.oauth2.sdk.Scope; //导入方法依赖的package包/类
public Map<Scope.Value, String> getResourceScopes() {
	return this.resourceScopes;
}
 
开发者ID:vpavic,项目名称:simple-openid-provider,代码行数:4,代码来源:OpenIdProviderProperties.java

示例12: getScopeClaims

import com.nimbusds.oauth2.sdk.Scope; //导入方法依赖的package包/类
public Map<Scope.Value, List<String>> getScopeClaims() {
	return this.scopeClaims;
}
 
开发者ID:vpavic,项目名称:simple-openid-provider,代码行数:4,代码来源:OpenIdProviderProperties.java


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