class OpaJwtPrincipalFactory implements Factory<OpaJwtPrincipal> {

  @Override
  public OpaJwtPrincipal provide() {
    Principal userPrincipal = securityContext.getUserPrincipal();
    if (userPrincipal instanceof OpaJwtPrincipal) {
      return (OpaJwtPrincipal) userPrincipal;
    }
    return null;
  }

  @Inject public  OpaJwtPrincipalFactory(SecurityContext securityContext);

}