LoginSignup
0
0

More than 3 years have passed since last update.

Spring BootプロジェクトにSpring Securityを導入する

Last updated at Posted at 2021-01-15

目次

  • REST APIの作成
  • Spring Securityの導入
  • API実行
  • 認可サーバーの設定

REST APIの作成

Spring BootのREST APIの作成 を参照し、APIを作成する。

Spring Securityの導入

pom.xmlにて依存関係を追加する。

pom.xml

<dependency>
    <groupId>org.springframework.boot</groupId>
    <artifactId>spring-boot-starter-oauth2-resource-server</artifactId>
</dependency>

API実行

  • KeycloakDemoApplication.javaを実行し、ブラウザにて、「http://localhost:8080/getObject 」を実行する。

  • 実装内容が表示されず、ログイン画面が表示されるようになる。

image.png

0
0
1

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0