Skip to content
Permalink
Browse files
adding @ANy
  • Loading branch information
rmannibucau committed Apr 21, 2018
1 parent 776abe1 commit caef28c5fc1720a88ee83efd7dce3171f295596f
Showing 3 changed files with 9 additions and 12 deletions.
@@ -36,6 +36,7 @@
import javax.enterprise.context.ApplicationScoped;
import javax.enterprise.context.Dependent;
import javax.enterprise.event.Observes;
import javax.enterprise.inject.Any;
import javax.enterprise.inject.Default;
import javax.enterprise.inject.Instance;
import javax.enterprise.inject.spi.AfterBeanDiscovery;
@@ -92,7 +93,7 @@ void addClaimBeans(@Observes final AfterBeanDiscovery afterBeanDiscovery) {
.id(GeronimoJwtAuthExtension.class.getName() + "#" + JsonWebToken.class.getName())
.beanClass(JsonWebToken.class)
.types(JsonWebToken.class, Object.class)
.qualifiers(Default.Literal.INSTANCE)
.qualifiers(Default.Literal.INSTANCE, Any.Literal.INSTANCE)
.scope(ApplicationScoped.class)
.createWith(ctx -> {
final JwtRequest request = this.request.get();
@@ -105,8 +106,7 @@ void addClaimBeans(@Observes final AfterBeanDiscovery afterBeanDiscovery) {
injectionPoints.forEach(injection ->
afterBeanDiscovery.addBean()
.id(GeronimoJwtAuthExtension.class.getName() + "#" + injection.getId())
.beanClass(injection.findClass())
.qualifiers(injection.literal())
.qualifiers(injection.literal(), Any.Literal.INSTANCE)
.scope(injection.findScope())
.types(injection.type, Object.class)
.createWith(ctx -> injection.createInstance(request.get())));
@@ -334,7 +334,7 @@ public boolean equals(final Object o) {
return false;
}
final Injection injection = Injection.class.cast(o);
return name.equals(injection.name) && claims == injection.claims && type.equals(injection.type);
return runtimeName.equals(injection.runtimeName) && type.equals(injection.type);
}

@Override
@@ -344,10 +344,7 @@ public int hashCode() {

@Override
public String toString() {
return "Injection{" +
"claim='" + ofNullable(name).filter(n -> !n.isEmpty()).orElse(claims.name()) +
"', type=" + type +
'}';
return "Injection{claim='" + runtimeName + "', type=" + type + '}';
}
}

@@ -16,6 +16,7 @@
*/
package org.apache.geronimo.microprofile.impl.jwtauth.jwt;

import static java.util.Collections.emptySet;
import static java.util.stream.Collectors.toSet;

import java.util.Set;
@@ -67,6 +68,9 @@ public <T> T getClaim(final String claimName) {
}
if (claim.getType() == Set.class) {
final JsonValue jsonValue = delegate.get(claimName);
if (jsonValue == null) {
return (T) emptySet();
}
if (jsonValue.getValueType() == JsonValue.ValueType.ARRAY) {
return (T) JsonArray.class.cast(jsonValue).stream()
.map(this::toString)
@@ -15,10 +15,6 @@
<test name="Tests">
<classes>
<class name="org.eclipse.microprofile.jwt.tck.container.jaxrs.PrimitiveInjectionTest">
<methods>
<include name="verifyInjectedAudience"/>
<include name="verifyInjectedGroups"/>
</methods>
</class>
</classes>
</test>

0 comments on commit caef28c

Please sign in to comment.