Skip to content

Commit 997fa38

Browse files
committed
we are moved to KeyCloak
1 parent a5fa58f commit 997fa38

File tree

3 files changed

+50
-10
lines changed

3 files changed

+50
-10
lines changed

readme.txt

Lines changed: 20 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,8 @@ Project contains following components and layers
77
2) Authorization:
88
2.1) Internal basic authorization
99
2.2) OAuth2 with internal authorization server
10-
2.3) OAuth2 with OpenAm authorization server
10+
2.3) OAuth2 with KeyCloak (\src\main\resources\application.yml) and
11+
OpenAm (src\main\resources\configsBackups\OpenAm_Application) authorization server
1112
############################################################################################################################################
1213
########################################################## OAUTH2 TERMS ####################################################################
1314
Resource Owner � an entity that is able to grant access to its protected resources
@@ -16,7 +17,7 @@ Resource Server
1617
Client � an entity that is capable of obtaining access tokens from authorization servers
1718

1819
Spring:
19-
@EnableResourceServer configures component as entity that can obtain access_token (in my final case it External Identity Server = OpenAm)
20+
@EnableResourceServer configures component as entity that can obtain access_token (in my final case it External Identity Server = KeyCloak or OpenAm)
2021
@EnableOAuth2Sso makes application an OAuth2 client
2122
############################################################################################################################################
2223
#################################################### INTERNAL OAUTH2 SECTION ###############################################################
@@ -147,7 +148,23 @@ You'll receive following JSON on userInfo request:
147148
###########################################################################################################################################
148149
####################################################### KEY CLOAK #########################################################################
149150
My KeyCloak server is running on http://127.0.0.1:8890/, realm is master
150-
it is possible to see endpoints
151+
it is possible to see endpoints here
152+
153+
Token generation Endpoint is: http://127.0.0.1:8890/auth/realms/master/protocol/openid-connect/token
154+
we like for openAm sending data through body as x-www-form-urlencoded and we sending
155+
(client_id, client_secret, grant_type, username, password and scope)
156+
157+
UserInfo endpoint is - http://127.0.0.1:8890/auth/realms/master/protocol/openid-connect/userinfo
158+
UserInfo data is:
159+
{
160+
"sub": "d2f8b2b7-baab-42df-9567-cc2871dc1ff8",
161+
"email_verified": false,
162+
"user_name": "m_ushakov",
163+
"name": "Mikhail Ushakov",
164+
"preferred_username": "m_ushakov",
165+
"given_name": "Mikhail",
166+
"family_name": "Ushakov"
167+
}
151168
###########################################################################################################################################
152169
############################################################## RESOURCES ##################################################################
153170
OAuth protocol description: https://tools.ietf.org/html/rfc6749#section-3

src/main/resources/application.yml

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -3,20 +3,20 @@ security:
33
enabled: false
44
oauth2:
55
client:
6-
clientId: oauth2agent
7-
clientSecret: 12345678
8-
accessTokenUri: http://localhost:8899/OpenAM-14.4.2/oauth2/access_token?realm=abcdemo
9-
userAuthorizationUri: http://localhost:8899/OpenAM-14.4.2/oauth2/authorize?realm=abcdemo
6+
clientId: oauth2Agent
7+
clientSecret: c08668ec-cfdb-41fb-8faa-52d27f3cbb16
8+
accessTokenUri: http://127.0.0.1:8890/auth/realms/master/protocol/openid-connect/token
9+
userAuthorizationUri: http://127.0.0.1:8890/auth/realms/master/protocol/openid-connect/auth
1010
authorizedGrantTypes: code token
1111
scope: local
12-
username: mjolnir
13-
password: 12345678
12+
username: manager
13+
password: 123
1414
## tokenName: accessToken
1515
## redirectUri: http://localhost:8080/api/users
1616
## authenticationScheme: query
1717
## clientAuthenticationScheme: header
1818
resource:
19-
userInfoUri: http://localhost:8899/OpenAM-14.4.2/oauth2/userinfo?realm=abcdemo
19+
userInfoUri: http://127.0.0.1:8890/auth/realms/master/protocol/openid-connect/userinfo
2020
logging:
2121
level:
2222
org:
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
security:
2+
basic:
3+
enabled: false
4+
oauth2:
5+
client:
6+
clientId: oauth2agent
7+
clientSecret: 12345678
8+
accessTokenUri: http://localhost:8899/OpenAM-14.4.2/oauth2/access_token?realm=abcdemo
9+
userAuthorizationUri: http://localhost:8899/OpenAM-14.4.2/oauth2/authorize?realm=abcdemo
10+
authorizedGrantTypes: code token
11+
scope: local
12+
username: mjolnir
13+
password: 12345678
14+
## tokenName: accessToken
15+
## redirectUri: http://localhost:8080/api/users
16+
## authenticationScheme: query
17+
## clientAuthenticationScheme: header
18+
resource:
19+
userInfoUri: http://localhost:8899/OpenAM-14.4.2/oauth2/userinfo?realm=abcdemo
20+
logging:
21+
level:
22+
org:
23+
springframework: DEBUG

0 commit comments

Comments
 (0)