Skip to content

Commit

Permalink
Handle InjectionPointsTransformer deprecations in OIDC extension
Browse files Browse the repository at this point in the history
  • Loading branch information
michalvavrik committed Nov 10, 2024
1 parent 0782ecc commit 998c3ee
Showing 1 changed file with 5 additions and 21 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -230,28 +230,12 @@ public boolean appliesTo(Type requiredType) {

@Override
public void transform(TransformationContext ctx) {
if (ctx.getTarget().kind() == METHOD) {
var tenantAnnotation = Annotations.find(ctx.getAllTargetAnnotations(), TENANT_NAME);
if (tenantAnnotation != null && tenantAnnotation.value() != null) {
ctx
.getAllAnnotations()
.stream()
.filter(a -> TENANT_NAME.equals(a.name()))
.forEach(a -> {
var annotationValue = new AnnotationValue[] {
AnnotationValue.createStringValue("value", a.value().asString()) };
ctx
.transform()
.add(AnnotationInstance.create(NAMED, a.target(), annotationValue))
.done();
});
} else {
// field
var tenantAnnotation = Annotations.find(ctx.getAllAnnotations(), TENANT_NAME);
if (tenantAnnotation != null && tenantAnnotation.value() != null) {
ctx
.transform()
.add(NAMED, AnnotationValue.createStringValue("value", tenantAnnotation.value().asString()))
.done();
}
.transform()
.add(NAMED, AnnotationValue.createStringValue("value", tenantAnnotation.value().asString()))
.done();
}
}
});
Expand Down

0 comments on commit 998c3ee

Please sign in to comment.