Skip to content

m-moris/azure-java-sample-spring-boot-security

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Spring Boot and OAuth2 with Azure Active Directory

Japanese

Sample application of Spring Boot Security and Azure Active Directory.

Requirements

  • Azure subscription

Preparation

You configure authentication and directory access. Please refer to the following URL.

Create a line-of-business Azure app with Azure Active Directory authentication

When you register web application into AAD. You will get following informations.

  • Tenant id
  • Client id
  • Client key (Secred key)

You embed these id/key into application.yaml.

security:
  oauth2:
    client:
      clientId: <<your client id >>
      clientSecret: <<your client key>>
      accessTokenUri: https://login.microsoftonline.com/<<your tenant id>>/oauth2/token
      userAuthorizationUri: https://login.microsoftonline.com/<<your tenant id>/oauth2/authorize
      clientAuthenticationScheme: form
      scope: read
    resource:
      preferTokenInfo: false
      userInfoUri: https://graph.windows.net/me?api-version=1.6

...

aad:
  resource: https://graph.windows.net

Execution

You can execute the following commands.

$ bower install
$ mvn spring-boot:run
  • Open http://localhost:8080/
  • Click login button.
  • Redirect authentication page and logi it.
  • The login uers's information will be displayed.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published