Skip to content

Commit 93de45e

Browse files
committed
App consent is added to the session
1 parent 3e7104b commit 93de45e

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

lib/requests/consent-request.js

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,7 @@ class ConsentRequest extends AuthRequest {
7373
appOrigin === req.app.locals.ldp.serverUri ||
7474
await request.isAppRegistered(req.app.locals.ldp, appOrigin, request.session.subject._id)
7575
) {
76+
request.setUserConsent(appOrigin)
7677
request.redirectPostConsent()
7778
} else {
7879
request.renderForm(null, req)
@@ -105,13 +106,23 @@ class ConsentRequest extends AuthRequest {
105106

106107
if (consented) {
107108
await request.registerApp(req.app.locals.ldp, appOrigin, accessModes, request.session.subject._id)
109+
request.setUserConsent(appOrigin)
108110
}
109111

110112
// Redirect once that's all done
111113
request.redirectPostConsent()
112114
}
113115
}
114116

117+
setUserConsent (appOrigin) {
118+
if (!this.session.consentedOrigins) {
119+
this.session.consentedOrigins = []
120+
}
121+
if (!this.session.consentedOrigins.includes(appOrigin)) {
122+
this.session.consentedOrigins.push(appOrigin)
123+
}
124+
}
125+
115126
isUserLoggedIn () {
116127
// Ensure the user arrived here by logging in
117128
if (!this.session.subject || !this.session.subject._id) {

0 commit comments

Comments
 (0)