Skip to content

Commit abefada

Browse files
authored
Development: Fix email login (#478)
* remove duplicate text * add translations * adapt code to PR comments * add translations to email login * login TUM icon smaller * smaller login * change tab color * add dialog * fix register/login button * add token refresh * enable email login * openapi * adapt auth card to openapi * change cookie * fix client style * fix compile * remove ribbon * fix tests and remove files * add refresh token to login endpoint * update package-lock.json * add refresh token endpoint * openAPI * adapt bruno * add logout endpoint * change refresh api in bruno * add cookie handling in SecurityConfiguration * openApi * ignore generated files in for prettier * login endpoint returns expires in time * openapi * Add authentication.service.ts for email login handling * add authentication facade to handle keycloak and email * add facade to app initializer * adapt interceptor * add page ribbon again * adapt auth card * adapt account service * fix email login call * move start token refresh in keycloak login * move load user * adapt keycloak realm config * fix client style * fix tests * fix tests * start timer on refresh * add expire in to refresh endpoint * refresh access token when access token is not there * fix client style * remove duplicates * client style
1 parent 944e65a commit abefada

89 files changed

Lines changed: 4205 additions & 3939 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.env.example

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,9 +14,9 @@ KEYCLOAK_ADMIN_PASSWORD=admin
1414
# Enables Keycloak-related debug logging (true/false)
1515
KEYCLOAK_ENABLE_LOGGING=true
1616
# Secret used by the server to authenticate securely with Keycloak
17-
KEYCLOAK_SERVER_CLIENT_SECRET=***
17+
KEYCLOAK_SERVER_CLIENT_SECRET=tumapply-server-secret
1818
# Client ID used by the server to authenticate with Keycloak
19-
KEYCLOAK_SERVER_CLIENT_ID=***
19+
KEYCLOAK_SERVER_CLIENT_ID=tumapply-server-client
2020

2121
#################################
2222
# 🗄️ MySQL Configuration

.prettierignore

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ node_modules
22
package-lock.json
33
.git
44
renovate.json
5-
src/main/webapp/app/generated/README.md
5+
src/main/webapp/app/generated
66
openapi
77

88
# Generated by jhipster:gradle

docs/TUMApply API/Authentication/Email Login Token.bru renamed to docs/TUMApply API/Authentication/Email Login/Login.bru

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
meta {
2-
name: Email Login Token
2+
name: Login
33
type: http
4-
seq: 3
4+
seq: 1
55
}
66

77
post {
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
meta {
2+
name: Logout
3+
type: http
4+
seq: 3
5+
}
6+
7+
post {
8+
url: {{baseUrl}}/api/auth/logout
9+
body: none
10+
auth: none
11+
}
12+
13+
body:json {
14+
{
15+
"email": "applicant1@tumapply.local",
16+
"password": "applicant"
17+
}
18+
}
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
meta {
2+
name: Token Refresh
3+
type: http
4+
seq: 4
5+
}
6+
7+
post {
8+
url: {{baseUrl}}/api/auth/refresh
9+
body: none
10+
auth: none
11+
}
12+
13+
body:json {
14+
{
15+
"email": "applicant1@tumapply.local",
16+
"password": "applicant"
17+
}
18+
}
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
meta {
2+
name: Email Login
3+
seq: 3
4+
}
5+
6+
auth {
7+
mode: inherit
8+
}

docs/TUMApply API/Authentication/Keycloak Logout.bru

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
meta {
22
name: Keycloak Logout
33
type: http
4-
seq: 3
4+
seq: 2
55
}
66

77
get {
@@ -27,7 +27,7 @@ auth:oauth2 {
2727
state: {{$guid}}
2828
pkce: true
2929
credentials_placement: basic_auth_header
30-
credentials_id:
30+
credentials_id: credentials
3131
token_placement: header
3232
token_header_prefix:
3333
auto_fetch_token: true

openapi/openapi.yaml

Lines changed: 42 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -568,10 +568,36 @@
568568
}
569569
}
570570
},
571+
"/api/auth/refresh": {
572+
"post": {
573+
"tags": [
574+
"authentication-resource"
575+
],
576+
"operationId": "refresh",
577+
"responses": {
578+
"200": {
579+
"description": "OK"
580+
}
581+
}
582+
}
583+
},
584+
"/api/auth/logout": {
585+
"post": {
586+
"tags": [
587+
"authentication-resource"
588+
],
589+
"operationId": "logout",
590+
"responses": {
591+
"200": {
592+
"description": "OK"
593+
}
594+
}
595+
}
596+
},
571597
"/api/auth/login": {
572598
"post": {
573599
"tags": [
574-
"email-login-resource"
600+
"authentication-resource"
575601
],
576602
"operationId": "login",
577603
"requestBody": {
@@ -586,7 +612,18 @@
586612
},
587613
"responses": {
588614
"200": {
589-
"description": "OK"
615+
"description": "OK",
616+
"content": {
617+
"application/json": {
618+
"schema": {
619+
"type": "object",
620+
"additionalProperties": {
621+
"type": "integer",
622+
"format": "int64"
623+
}
624+
}
625+
}
626+
}
590627
}
591628
}
592629
}
@@ -2960,9 +2997,6 @@
29602997
"sort": {
29612998
"$ref": "#/components/schemas/SortObject"
29622999
},
2963-
"unpaged": {
2964-
"type": "boolean"
2965-
},
29663000
"paged": {
29673001
"type": "boolean"
29683002
},
@@ -2973,6 +3007,9 @@
29733007
"pageSize": {
29743008
"type": "integer",
29753009
"format": "int32"
3010+
},
3011+
"unpaged": {
3012+
"type": "boolean"
29763013
}
29773014
}
29783015
},

package-lock.json

Lines changed: 68 additions & 9 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/main/docker/realm-config/tumapply-realm.json

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -103,6 +103,7 @@
103103
"clients": [
104104
{
105105
"clientId": "tumapply-client",
106+
"name": "TUMApply Client",
106107
"enabled": true,
107108
"publicClient": true,
108109
"protocol": "openid-connect",
@@ -128,6 +129,37 @@
128129
}
129130
}
130131
]
132+
},
133+
{
134+
"clientId": "tumapply-server-client",
135+
"name": "TUMApply Server Service",
136+
"enabled": true,
137+
"publicClient": false,
138+
"protocol": "openid-connect",
139+
"serviceAccountsEnabled": false,
140+
"standardFlowEnabled": true,
141+
"frontchannelLogout": true,
142+
"directAccessGrantsEnabled": true,
143+
"attributes": {
144+
"access.token.lifespan": "300",
145+
"refresh.token.lifespan": "1800"
146+
},
147+
"redirectUris": [],
148+
"webOrigins": [],
149+
"secret": "tumapply-server-secret",
150+
"protocolMappers": [
151+
{
152+
"name": "service-account-audience",
153+
"protocol": "openid-connect",
154+
"protocolMapper": "oidc-audience-mapper",
155+
"consentRequired": false,
156+
"config": {
157+
"included.client.audience": "tumapply-server-client",
158+
"id.token.claim": "false",
159+
"access.token.claim": "true"
160+
}
161+
}
162+
]
131163
}
132164
]
133165
}

0 commit comments

Comments
 (0)