quarkus-google-cloud-services
quarkus-google-cloud-services copied to clipboard
SecurityIdentity identity is not an instanceof JsonWebToken
The example code for getting a JsonWebToken
does not seem to work.
firebase-admin
@Path("/app")
public class FirebaseAppResource {
@Inject
FirebaseApp firebaseApp;
@Inject
SecurityIdentity identity;
@GET
@Path("/options")
@Produces(MediaType.APPLICATION_JSON)
public FirebaseOptions getOptions() {
if(identity instanceof JsonWebToken) {
System.out.println("JWT: " + ((JsonWebToken) identity).getClaim("email"));
}
return firebaseApp.getOptions();
}
}
When debugging my project identity is not an instanceof JsonWebToken
.
I'm able to do a workaround by casting identity.getPrincipal()
to a FirebasePrincipal
.
@GET
@Produces(MediaType.APPLICATION_JSON)
public FirebaseOptions getOptions() {
FirebasePrincipal fbp;
if(identity.getPrincipal() instanceof FirebasePrincipal) {
fbp = (FirebasePrincipal) identity.getPrincipal();
System.out.println("FirebasePrincipal: " + fbp.getClaim("email"));
}
return firebaseApp.getOptions();
}
Is this an issue with the documentation or should identity be an instance of JsonWebToken
?