Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit 78b87e7

Browse files
added readme
1 parent 2871067 commit 78b87e7

File tree

1 file changed

+79
-0
lines changed

1 file changed

+79
-0
lines changed

‎README.md‎

Lines changed: 79 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,79 @@
1+
# spring-boot-oauth2-jwt-swagger-ui
2+
Spring Boot , OAuth 2 , JWT (Json Web Token) and Swagger UI
3+
4+
# Spring Boot + OAuth 2.0 + JWT + Swagger-UI 2?
5+
6+
## How to start ?
7+
8+
```
9+
$ mvn spring-boot:run
10+
```
11+
12+
## Swagger-UI
13+
* After starting the application Click on [Swagger-home](http://localhost:8080/api/swagger-ui.html)
14+
15+
![Swagger-Home](/authentication/src/main/resources/images/Swagger-UI-Home.png "Swagger UI Home")
16+
17+
18+
## User Data
19+
20+
```
21+
user-name | password
22+
user1@example.com | password
23+
user2@example.com | password
24+
user3@example.com | password
25+
```
26+
27+
28+
## Authorize
29+
* Use above given user details to login and generate the authorization token.
30+
![Swagger-Home](/authentication/src/main/resources/images/Swagger-ui-auth.png "Swagger UI Home")
31+
32+
![Swagger-Home](/authentication/src/main/resources/images/swagger-ui-login.png "Swagger UI Home")
33+
34+
* Login using the generated token
35+
![Swagger-Home](/authentication/src/main/resources/images/swagger-ui-login-token.png "Swagger UI Home")
36+
37+
38+
39+
## Change OAuth configuration
40+
* Edit the configuration in the file [application.properties](/authentication/src/main/resources/application.properties)
41+
42+
```
43+
server.port=8080
44+
server.contextPath=/api
45+
46+
logging.level.com.alfred=DEBUG
47+
48+
# Data source properties
49+
spring.jpa.hibernate.ddl-auto=validate
50+
spring.jpa.show-sql=true
51+
52+
# openssl genrsa -out jwt.pem 2048
53+
# openssl rsa -in jwt.pem
54+
config.oauth2.privateKey=MIICXQIBAAKBgQDNQZKqTlO/+2b4ZdhqGJzGBDltb5PZmBz1ALN2YLvt341pH6i5mO1V9cX5Ty1LM70fKfnIoYUP4KCE33dPnC7LkUwE/myh1zM6m8cbL5cYFPyP099thbVxzJkjHWqywvQih/qOOjliomKbM9pxG8Z1dB26hL9dSAZuA8xExjlPmQIDAQABAoGAImnYGU3ApPOVtBf/TOqLfne+2SZX96eVU06myDY3zA4rO3DfbR7CzCLE6qPnyDAIiW0UQBs0oBDdWOnOqz5YaePZu/yrLyj6KM6Q2e9ywRDtDh3ywrSfGpjdSvvoaeL1WesBWsgWv1vFKKvES7ILFLUxKwyCRC2Lgh7aI9GGZfECQQD84m98Yrehhin3fZuRaBNIu348Ci7ZFZmrvyxAIxrV4jBjpACW0RM2BvF5oYM2gOJqIfBOVjmPwUrobYEFcHRvAkEAz8jsfmxsZVwh3Y/Y47BzhKIC5FLaads541jNjVWfrPirljyCy1n4sg3WQH2IEyap3WTP84+csCtsfNfyK7fQdwJBAJNRyobY74cupJYkW5OK4OkXKQQLHp2iosJV/Y5jpQeC3JO/gARcSmfIBbbI66q9zKjtmpPYUXI4tc3PtUEY8QsCQQCcxySyC0sKe6bNzyC+Q8AVvkxiTKWiI5idEr8duhJd589H72Zc2wkMB+a2CEGo+Y5Hjy5cvuph/pG/7Qw7sljnAkAy/feClt1mUEiAcWrHRwcQ71AoA0+21yC9VkqPNrn3w7OEg8gBqPjRlXBNb00QieNeGGSkXOoU6gFschR22Dzy
55+
56+
# openssl rsa -in jwt.pem -pubout
57+
config.oauth2.publicKey=MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQDNQZKqTlO/+2b4ZdhqGJzGBDltb5PZmBz1ALN2YLvt341pH6i5mO1V9cX5Ty1LM70fKfnIoYUP4KCE33dPnC7LkUwE/myh1zM6m8cbL5cYFPyP099thbVxzJkjHWqywvQih/qOOjliomKbM9pxG8Z1dB26hL9dSAZuA8xExjlPmQIDAQAB
58+
59+
60+
#oauth configurations
61+
config.oauth2.tokenTimeout=3600
62+
config.oauth2.resource.id=oauth2-resource
63+
config.oauth2.clientID=client
64+
config.oauth2.clientSecret=secret
65+
security.oauth2.client.grantType=client_credentials
66+
config.oauth2.accessTokenUri=http://localhost:8080/api/oauth/token
67+
config.oauth2.userAuthorizationUri=http://localhost:8080/api/oauth/authorize
68+
config.oauth2.resourceURI= http://localhost:8080/api/oauth/authorize
69+
```
70+
71+
72+
73+
74+
75+
76+
77+
78+
79+

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /