Skip to content

BrookZX/SprintBootTest

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

17 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

<<<<<<< HEAD Setup: 需要参考application.yml配置mysql数据库, 编译打包war手动部署到tomcat上

==================

  1. Register:

Post: http://localhost:8080/springbootdemo-0.0.1-SNAPSHOT/auth/register

{ "username": "zhaox", "password": "abcd", "email": "na" }

  1. Login:

Post http://localhost:8080/springbootdemo-0.0.1-SNAPSHOT/auth { "username": "zhaox", "password": "abcd" }

Response: { "token": "eyJhbGciOiJIUzUxMiJ9.eyJzdWIiOiJ6aGFveCIsImNyZWF0ZWQiOjE1MjUyMjgyOTMxMzYsImV4cCI6MTUyNTgzMzA5M30.oueO4KesKsPv59Wt6bsyj9AP2u7wOAPZQzt8GCd2WmnbtY4F-etVF6JAbyU_vQUod-uyVMdihPK5WLpIXUHv9g" }

  1. Fetch user

Get http://localhost:8080/springbootdemo-0.0.1-SNAPSHOT/users/?username=zhaox

Header: Bearer eyJhbGciOiJIUzUxMiJ9.eyJzdWIiOiJ6aGFveCIsImNyZWF0ZWQiOjE1MjUyMjgyOTMxMzYsImV4cCI6MTUyNTgzMzA5M30.oueO4KesKsPv59Wt6bsyj9AP2u7wOAPZQzt8GCd2WmnbtY4F-etVF6JAbyU_vQUod-uyVMdihPK5WLpIXUHv9g

Response { "id": 1, "username": "zhaox", "password": "$2a$10$M3n.jpDyVE0paMygSxnYTeTQJ9hIBv1XoulKJiBlJXNCNt27z3pAO", "email": "na", "lastPasswordResetDate": "2018-05-02T02:22:44.000+0000", "roles": [] }

================== JWT参数信息定义在 application.yml里面

OData可以仿照("/users")service 里面进行控制

http://localhost:8080/springbootdemo-0.0.1-SNAPSHOT/odata/Products

Authorization Bearer eyJhbGciOiJIUzUxMiJ9.eyJzdWIiOiJ6aGFveCIsImNyZWF0ZWQiOjE1MjUyNDc4NTIxOTMsImV4cCI6MTUyNTg1MjY1Mn0.wF5quHy_WMwycoej90CnfvR1JtIqzB8Mka8nS8GpF1xPmkRQD7PTcZXsZ3azulRaiE9_zHeO3eXi6s1i87FJow

结果 { "@odata.context": "$metadata#Products", "value": [ { "ID": 1, "Name": "Notebook Basic 15", "Description": "Notebook Basic, 1.7GHz - 15 XGA - 1024MB DDR2 SDRAM - 40GB" }, { "ID": 2, "Name": "1UMTS PDA", "Description": "Ultrafast 3G UMTS/HSDPA Pocket PC, supports GSM network" }, { "ID": 3, "Name": "Ergo Screen", "Description": "17 Optimum Resolution 1024 x 768 @ 85Hz, resolution 1280 x 960" } ] }

总结 spring security 作用:

  1. 提供单独的log in 界面, 尤其是在CF环境
  2. 提供JWT的实现点
  3. 减少UAA交互

=================================== Spring MVC, 同样通过controller里面的path 进行控制, 如果是自开发loginpage需要在security config里面添加permitAll路径

SprintBootTest

branch 'master' of https://github.com/i048920/SprintBootTest

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published