Java Code Examples for org.eclipse.microprofile.jwt.Claims#UNKNOWN
The following examples show how to use
org.eclipse.microprofile.jwt.Claims#UNKNOWN .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: ProviderExtensionSupport.java From smallrye-jwt with Apache License 2.0 | 6 votes |
/** * Collect the types of all {@linkplain Provider} injection points annotated with {@linkplain Claim}. * * @param pip - the injection point event information */ void processClaimProviderInjections(@Observes ProcessInjectionPoint<?, ? extends Provider> pip) { CDILogging.log.pip(pip.getInjectionPoint()); final InjectionPoint ip = pip.getInjectionPoint(); if (ip.getAnnotated().isAnnotationPresent(Claim.class)) { Claim claim = ip.getAnnotated().getAnnotation(Claim.class); if (claim.value().length() == 0 && claim.standard() == Claims.UNKNOWN) { pip.addDefinitionError(CDIMessages.msg.claimHasNoNameOrValidStandardEnumSetting(ip)); } boolean usesEnum = claim.standard() != Claims.UNKNOWN; final String claimName = usesEnum ? claim.standard().name() : claim.value(); CDILogging.log.checkingProviderClaim(claimName, ip); Type matchType = ip.getType(); // The T from the Provider<T> injection site Type actualType = ((ParameterizedType) matchType).getActualTypeArguments()[0]; // Don't add Optional or JsonValue as this is handled specially if (isOptional(actualType)) { // Validate that this is not an Optional<JsonValue> Type innerType = ((ParameterizedType) actualType).getActualTypeArguments()[0]; if (!isJson(innerType)) { providerOptionalTypes.add(actualType); providerQualifiers.add(claim); } } } }
Example 2
Source File: JWTCallerPrincipal.java From smallrye-jwt with Apache License 2.0 | 5 votes |
protected Claims getClaimType(String claimName) { Claims claimType; try { claimType = Claims.valueOf(claimName); } catch (IllegalArgumentException e) { claimType = Claims.UNKNOWN; } return claimType; }
Example 3
Source File: RawClaimTypeProducer.java From smallrye-jwt with Apache License 2.0 | 5 votes |
static String getName(InjectionPoint ip) { String name = null; for (Annotation ann : ip.getQualifiers()) { if (ann instanceof Claim) { Claim claim = (Claim) ann; name = claim.standard() == Claims.UNKNOWN ? claim.value() : claim.standard().name(); } } return name; }
Example 4
Source File: ProviderExtensionSupport.java From smallrye-jwt with Apache License 2.0 | 5 votes |
/** * Replace the general producer method BeanAttributes with one bound to the collected injection site * types to properly reflect all of the type locations the producer method applies to. * * @param pba the ProcessBeanAttributes * @see ProviderBeanAttributes */ public void addTypeToClaimProducer(@Observes ProcessBeanAttributes pba) { if (!providerOptionalTypes.isEmpty() && pba.getAnnotated().isAnnotationPresent(Claim.class)) { Claim claim = pba.getAnnotated().getAnnotation(Claim.class); if (claim.value().length() == 0 && claim.standard() == Claims.UNKNOWN) { CDILogging.log.addTypeToClaimProducer(pba.getAnnotated()); BeanAttributes delegate = pba.getBeanAttributes(); if (delegate.getTypes().contains(Optional.class)) { pba.setBeanAttributes(new ProviderBeanAttributes(delegate, providerOptionalTypes, providerQualifiers)); } } } }
Example 5
Source File: CommonJwtProducer.java From smallrye-jwt with Apache License 2.0 | 5 votes |
public String getName(InjectionPoint ip) { String name = null; for (Annotation ann : ip.getQualifiers()) { if (ann instanceof Claim) { Claim claim = (Claim) ann; name = claim.standard() == Claims.UNKNOWN ? claim.value() : claim.standard().name(); } } return name; }
Example 6
Source File: HammockClaimValue.java From hammock with Apache License 2.0 | 5 votes |
public HammockClaimValue(JWTPrincipal jwtPrincipal, ClaimDefinition claimDefinition) { this.jwtPrincipal = jwtPrincipal; this.claimDefinition = claimDefinition; this.name = claimDefinition.claim.standard() == Claims.UNKNOWN ? claimDefinition.claim.value() : claimDefinition.claim.standard().name(); this.realValue = getRealValue(); }
Example 7
Source File: ClaimQualifier.java From smallrye-jwt with Apache License 2.0 | 4 votes |
ClaimQualifier(String value, Claims standard) { this.value = value != null ? value : ""; this.standard = standard != null ? standard : Claims.UNKNOWN; }
Example 8
Source File: ClaimLiteral.java From hammock with Apache License 2.0 | 4 votes |
@Override public Claims standard() { return Claims.UNKNOWN; }
Example 9
Source File: ClaimBean.java From tomee with Apache License 2.0 | 4 votes |
public static String getClaimKey(final Claim claim) { return claim.standard() == Claims.UNKNOWN ? claim.value() : claim.standard().name(); }
Example 10
Source File: ClaimBean.java From tomee with Apache License 2.0 | 4 votes |
@Override public Claims standard() { return Claims.UNKNOWN; }