本文整理汇总了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);
}
示例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;
}
示例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));
}
}
示例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);
}
示例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);
}
}
示例6: setResourceScopes
import com.nimbusds.oauth2.sdk.Scope; //导入方法依赖的package包/类
public void setResourceScopes(Map<Scope.Value, String> resourceScopes) {
this.resourceScopes = resourceScopes;
}
示例7: setScopeClaims
import com.nimbusds.oauth2.sdk.Scope; //导入方法依赖的package包/类
public void setScopeClaims(Map<Scope.Value, List<String>> scopeClaims) {
this.scopeClaims = scopeClaims;
}
示例8: setSupportedScopes
import com.nimbusds.oauth2.sdk.Scope; //导入方法依赖的package包/类
public void setSupportedScopes(List<Scope.Value> supportedScopes) {
this.supportedScopes = supportedScopes;
}
示例9: getOpenidScopes
import com.nimbusds.oauth2.sdk.Scope; //导入方法依赖的package包/类
public List<Scope.Value> getOpenidScopes() {
return this.openidScopes;
}
示例10: setOpenidScopes
import com.nimbusds.oauth2.sdk.Scope; //导入方法依赖的package包/类
public void setOpenidScopes(List<Scope.Value> openidScopes) {
this.openidScopes = openidScopes;
}
示例11: getResourceScopes
import com.nimbusds.oauth2.sdk.Scope; //导入方法依赖的package包/类
public Map<Scope.Value, String> getResourceScopes() {
return this.resourceScopes;
}
示例12: getScopeClaims
import com.nimbusds.oauth2.sdk.Scope; //导入方法依赖的package包/类
public Map<Scope.Value, List<String>> getScopeClaims() {
return this.scopeClaims;
}