I don't think it's a bug. The built-in bean for Principal does not have to implement any other types, so from the spec point of view, you cannot simply typecast the injected object to KeycloakPrincipal. In fact, Weld is injecting a special proxy that delegates to the original Principal impl. And there are probably some good reasons to use the proxy here. Let me investigate further. |