Skip to content

Instantly share code, notes, and snippets.

@yamabicodev
Last active December 21, 2020 09:51
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save yamabicodev/49fcbc33d4313319b4984ab6506b3d47 to your computer and use it in GitHub Desktop.
Save yamabicodev/49fcbc33d4313319b4984ab6506b3d47 to your computer and use it in GitHub Desktop.
Spring Security OAuth2 Client Sample
spring:
security:
oauth2:
client:
# registrationセクションには、
# プロバイダ側でアプリケーション登録した際に発行されるClientID・Secret情報や、
# 認証タイプ・アクセススコープタイプ・プロバイダからのコールバック先等を指定する。
registration:
github: # registration Idと呼ばれる。
clientId: {your-github-client-id}
clientSecret: {your-github-client-secret}
# プロバイダ側でのログイン・認可後にプロバイダ→クライアントへのコールバック先のURL
# この項目を指定しない場合、
# プロバイダは「/login/oauth2/code/{registrationId}」形式でリダイレクト処理を行う。
redirectUri: http://localhost:8080/login/oauth2/code/github
scope:
- read:user
# providerセクションには、
# プロバイダ側で「認可エンドポイント」・「トークンエンドポイント」・「リソースのエンドポイント」等を指定する。
provider:
github:
# 認可エンドポイントURL
authorizationUri: https://github.com/login/oauth/authorize
# トークンエンドポイントURL
tokenUri: https://github.com/login/oauth/access_token
# リソースのエンドポイントURL
userInfoUri: https://api.github.com/user
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment