0

quarkus-oidc我有一个用于用户身份验证的 Quarkus (1.6.1.Final) 应用程序。我的服务器有一个 websocket 端点:

@ApplicationScoped
@ServerEndpoint(value="/websocket")
public class WebsocketEndpoint {
  @Inject
  SecurityIdentity identity;

  @OnOpen
  public void onOpen(Session session) {
    // at this point identity is always Anonymous, even if I use a valid auth header that works correctly on a normal REST endpoint.
  }
}

我希望能够在此端点上进行一些用户身份验证,最好是通过@RolesAllowed类上的注释。通过连接调试器,我可以单步执行OidcAuthenticationMechanism并验证SecurityIdentity对象是否正在构建并正确反映我的 JWT 的内容 - 但是,当我到达OnOpen回调时,它不再设置。@RolesAllowed(同样,在我的端点上使用 a 的任何尝试都会失败,因为SecurityIdentity是调用中的匿名用户RolesAllowedCheck。)

4

0 回答 0