Azure-Samples / Azure-Samples/ms-identity-msal-java-samples
Spring Tutorial-4/Auth-II - Group PreAuthorization mysteriously fails with valid Group ID claims in ID Token.
- Lenguaje dominante
- Java
- Estrellas
- 79
- Forks
- 82
- Métricas de merge de PR
- Sin PR fusionados en 30 d
Descripción
> Please provide us with the following information:
> ---------------------------------------------------------------
### This issue is for a: (mark with an `x`)
```
- [ ] bug report -> please search issues before submitting
- [ ] feature request
- [x] documentation issue or request
- [ ] regression (a behavior that used to work and stopped in a new release)
```
### Minimal steps to reproduce
> 4. Spring Framework Web App Tutorial/3-Authorization-II -
1. Run application and log in.
2. Observe ID Token Details and confirm that groups claim contains the AdminGroupId and the UserGroupId.
3. Confirm that PreAuthorization annotations have the 'correct' Group IDs
4. Click Admins Only.
### Any log messages given by the failure
> None observed
### Expected/desired behavior
> Expected: "Excellent! ..."
> Observed: "Sorry! ..."
### OS and Version?
> macOS Big Sur
### Versions
> Java version 11
### Mention any other details that might be useful
@GetMapping(path = "/admin_only")
@PreAuthorize("hasAuthority('48ca69cc-8f4f-4bd2-b12f-xxxxxxxxxxxx')")
Does not work.
Changing the PreAuthorization to hasRole() and Prefixing the group id with "ROLE_" as documented [here](https://microsoft.github.io/spring-cloud-azure/docs/4.0.0-beta.2/reference/html/index.html) appears to be working:
The roles example works as expected.
> ---------------------------------------------------------------
> Thanks! We'll be in touch soon.
Guía de contribución
No hay ninguna guía de contribución indexada para este repositorio
Línea de trabajo
Start with the Spring Framework Web App Tutorial/3-Authorization-II flow and the `/admin_only` endpoint shown in the report. Compare the ID token groups claim and its `@PreAuthorize` annotation with the documented roles example, then verify that the tutorial's documented authorization behavior matches the observed result.
Escrito por el modelo de indexación a partir del texto del issue.
Evaluación
- Stack tecnológico
- java, spring
- Área
- authorization, documentation
- Tipo de issue
- Documentación
- Dificultad
- 3/5
- Tiempo estimado
- 1-2 días
- Estado de actividad
- Estancado
- Claridad
- Bastante claro
- Aptitud para principiantes
- 35/100