需先启动Nacos
startup.cmd -m standalone
启动redis
端口:8101
端口:8102
端口:8103
端口:8104
application.yml 已移入到nacos 中,新建配置且Data ID命名为:jonesun-user-api.yml
启动sentinel dashboard
java -Dserver.port=8105 -Dcsp.sentinel.dashboard.server=localhost:8105 -Dproject.name=sentinel-dashboard -jar sentinel-dashboard-1.8.1.jar
端口 8106
使用keytool生成RSA证书jwt.jks,复制到resource目录下,使用如下命令即可
keytool -genkey -alias jwt -keyalg RSA -keystore jwt.jks
密码 123456
参考自spring-cloud-gateway-oauth2
POST http://localhost:8102/oauth/token
Content-Type: application/x-www-form-urlencoded
grant_type=password&client_id=client-app&client_secret=123456&username=admin&password=123456
输入用户名密码(admin 123456)得到授权码code
发送请求
POST http://localhost:8102/oauth/token
Content-Type: application/x-www-form-urlencoded
grant_type=authorization_code&client_id=client-app-2&client_secret=123456&code={code}&redirect_uri=https://jonesun.github.io
GET http://localhost:8102/jonesun-user-api/api/currentUser
Authorization: Bearer eyJhbGciOiJSUzI1NiIsInR5cCI6IkpXVCJ9.eyJhdWQiOlsib2F1dGgyLXJlc291cmNlIiwiam9uZXN1bi11c2VyLWFwaSJdLCJ1c2VyX25hbWUiOiJhZG1pbiIsInNjb3BlIjpbImFsbCJdLCJpZCI6MSwiZXhwIjoxNjE4MjA5OTE2LCJhdXRob3JpdGllcyI6WyJBRE1JTiJdLCJqdGkiOiJkMTg0NTFiNS0yOTNkLTRlNDQtOTU3Ni0wMzc4NWZkZmUxMjMiLCJjbGllbnRfaWQiOiJjbGllbnQtYXBwIn0.LJRgcbRxEVJAGXdWX33kBIvptOZ0GqZoUwOTbB9XoeHBL5c2fzaFuhaH-0HLoQ9tfzGumLOlpigD1DhiQEy0MPQbULG14IdN5m8YyyxsZcNxaNFoX-L-j4NIcuq1kskwrfUNhHLJSbsoJPfFL9LaROmjd-8Qa2Z87tCc3J7stwg642lSVqOj1yvUBMkx_sXAX-0uExWhlZf7Kjd1zFj3dp9cVAg2gpXAWTDGgrzxmZ_WJc_qXtKRqHnlvu_jZDn1CJvGBiFfs6mH7jeCxRjq5JocjMBKcH7zLrxbprNNE7E8eurRVHXAyoAdFu1brnkIjPGTHc7G9wMweAvbf8KndQ
POST http://localhost:8102/oauth/token
Content-Type: application/x-www-form-urlencoded
grant_type=refresh_token&client_id=client-app&client_secret=123456&refresh_token=eyJhbGciOiJSUzI1NiIsInR5cCI6IkpXVCJ9.eyJhdWQiOlsib2F1dGgyLXJlc291cmNlIl0sInVzZXJfbmFtZSI6ImFkbWluIiwic2NvcGUiOlsiYWxsIl0sImF0aSI6IjU1ZDIxMTU0LWJjNjMtNDgyYy1iOTY1LTZhNzA1MjU4NDQxZCIsImlkIjoxLCJleHAiOjE2MTgzMDMxNTIsImF1dGhvcml0aWVzIjpbIkFETUlOIl0sImp0aSI6IjAyNGI5N2Y4LTMwNzYtNDFkMy1iN2UyLTM1YTI1NWRkZGMxMCIsImNsaWVudF9pZCI6ImNsaWVudC1hcHAifQ.GUa--pBNN3JREEWzT4Qfq6HihKNU-rpJ_mZcejEIBqOmAvdW18sWwL5SubqlnF7-glDqq_FS1en7qFYIQ1knD17xHc9xVLzMqivODDxC35DPpHiBd8slt2kHGUfpRB7ITb3YGBomrpmRGvbm0hTYWg39EbPX9aWAM_xqOfjGxSydRBoZyztVESe7CkME-HiE2H0k-cUN7VbDhDzbn2sLxLnj8lYorsBILtEs8_oeTsThydeT4UYWI0zSafP82mFGmRDZqF7Qa5zDXWucvJDfqZEMN_P_EJjMkzl6D3i0bTqjcQy3QRe2GtDaG43bHOLrwIa1qgvSH-Sed6A-QEQm9g
npm i -g cnpm --registry=https://registry.npm.taobao.org
npm i -g vue-cli
vue -V
vue init webpack vuedemo
npm run dev
npm install axios -S
npm install --save iview
纯js版web登录demo
java版登录demo
简单vue登录demo