APIサーバとして作っているSpringBootアプリに認証の仕組みを入れようと思い、試行錯誤した内容をまとめておきます。 spring-securityを入れればよろしくやってくれるんじゃないの?と軽く思っていたのですが、思ったより長い道のりになってしまいました。 ID/PWでtokenを発行して、tokenを元にその他のAPIを呼び出せるか制御したい というのがやりたいことです。 いろいろ調べるとJWTという技術が使えそうだと判明して、「Implementing JWT Authentication on Spring BootAPIs」というサイトを参考に実装しています。 JWT(Json Web Token)とは 以下の3つのJSONデータを.で結合してできた文字列を、URLでも安全に送れるように暗号化したものです。これをtokenとして利用します。ジョットと読むらしいです He

概要 SpringSecurityとSpring Bootを利用して簡単なRestAPIのデモアプリケーションを実装しました。 記事の前半はSpringSecurity周りの実装、後半がコントローラの実装とそのテストコードについて説明しています。 ソースコードは[rubytomato/demo-security-spring2] (https://github.com/rubytomato/demo-security-spring2)にあります。 環境Windows 10 ProfessionalJava 1.8.0_172 Spring Boot 2.0.2 SpringSecurity 5.0.5 参考 [SpringSecurity Reference] (https://docs.spring.io/spring-security/site/docs/5.0.4.RE

Starting from this chapter?Clone the application repo and check out thebuild-api branch: git clone git@github.com:auth0-blog/menu-api-spring-boot-java.git \ menu-api \ --branchbuild-api Make the project folder your current directory: cd menu-api Then, install the project dependencies using Gradle: ./gradlew --refresh-dependencies Finally, update the application.properties file in src/main/resour
1リリース、障害情報などのサービスのお知らせ
最新の人気エントリーの配信
処理を実行中です
j次のブックマーク
k前のブックマーク
lあとで読む
eコメント一覧を開く
oページを開く