Skip to content

Commit

Permalink
Avoid using the constructor
Browse files Browse the repository at this point in the history
  • Loading branch information
sberyozkin committed Jul 12, 2023
1 parent 0229092 commit b36f073
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -707,8 +707,9 @@ import io.quarkus.oidc.TenantResolverInterceptor;
@HrTenant
@Interceptor
public class HrInterceptor extends TenantResolverInterceptor {
public HrInterceptor() {
super("hr");
@Override
protected String getTenantId() {
return "hr";
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,15 +10,12 @@
public abstract class TenantResolverInterceptor {
@Inject
RoutingContext routingContext;
private final String tenantId;

public TenantResolverInterceptor(String tenantId) {
this.tenantId = tenantId;
}

@AroundInvoke
public Object setTenant(InvocationContext context) throws Exception {
routingContext.put(OidcUtils.TENANT_ID_ATTRIBUTE, tenantId);
routingContext.put(OidcUtils.TENANT_ID_ATTRIBUTE, getTenantId());
return context.proceed();
}

protected abstract String getTenantId();
}
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,10 @@
@HrTenant
@Interceptor
public class HrInterceptor extends TenantResolverInterceptor {
public HrInterceptor() {
super("hr");

@Override
protected String getTenantId() {
return "hr";
}

}

0 comments on commit b36f073

Please sign in to comment.