digital-garden/knowledge/dev/java/frameworks/spring/Mock конфигурация для Oauth2 SpringBoot.md

39 lines
1.3 KiB
Markdown
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

---
tags:
- зрелость/🌱
date:
- - 2023-11-20
zero-link:
- "[[../../../../../garden/ru/meta/zero/00 Java разработка]]"
parents:
- "[[Снипеты на Java]]"
linked:
- "[[SpringBoot]]"
article: https://note.struchkov.dev/mock-konfighuratsiia-dlia-oauth2-springboot/
---
Полезно при локальной разработке, чтобы не цепляться к настоящему Oauth2 серверу.
```yml
spring:
security:
oauth2:
client:
registration:
mocklab:
provider: mocklab
client-authentication-method: basic
authorization-grant-type: authorization_code
scope: profile, email
redirect-uri: http://localhost:8080/login/oauth2/code/
clientId: mocklab_oidc
clientSecret: whatever
provider:
mocklab:
authorization-uri: https://oauth.mocklab.io/oauth/authorize
token-uri: https://oauth.mocklab.io/oauth/token
user-info-uri: https://oauth.mocklab.io/userinfo
user-name-attribute: sub
jwk-set-uri: https://oauth.mocklab.io/.well-known/jwks.json
```
Сначала регистрируем нашего кастомного провайдера, а дальше подключаем его.