-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'main' into dependabot/npm_and_yarn/tough-cookie-4.1.3
- Loading branch information
Showing
113 changed files
with
3,716 additions
and
1,084 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
# This will make sure the app is always imported when | ||
# Django starts so that shared_task will use this app. | ||
from .celery import app as celery_app | ||
|
||
__all__ = ('celery_app',) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
49 changes: 13 additions & 36 deletions
49
controlpanel/api/auth0_conns/auth0_nomis/fetchUserProfile.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,37 +1,14 @@ | ||
function(accessToken, ctx, cb) { | ||
var base_url = "{{gateway_url}}"; | ||
var user_endpoint = "/auth/api/user/me"; | ||
var user_profile_url = base_url + user_endpoint; | ||
|
||
// call oauth2 API with the accesstoken and create the profile | ||
request.get( | ||
user_profile_url, | ||
{ | ||
headers: { | ||
Authorization: "Bearer " + accessToken | ||
} | ||
}, | ||
function(err, resp, body) { | ||
if (err) { | ||
cb(err); | ||
return; | ||
} | ||
if (!/^2/.test("" + resp.statusCode)) { | ||
cb(body); | ||
return; | ||
} | ||
let parsedBody = JSON.parse(body); | ||
let profile = { | ||
user_id: parsedBody.staffId, | ||
nickname: parsedBody.name, | ||
name: parsedBody.name, | ||
email: parsedBody.username + "+" + parsedBody.activeCaseLoadId + "@nomis", | ||
username: parsedBody.username, | ||
blocked: !parsedBody.active, | ||
activeCaseLoadId: parsedBody.activeCaseLoadId, | ||
_nomisAccessToken: accessToken | ||
}; | ||
cb(null, profile); | ||
} | ||
); | ||
function fetchUserProfile(accessToken, context, callback) { | ||
// The email is only for auth0 usage purpose, not the actual email of login user | ||
const profile = { | ||
sub: context.sub, | ||
user_id: context.user_id, | ||
auth_source: context.auth_source, | ||
nickname: context.name, | ||
name: context.name, | ||
username: context.user_name, | ||
_accessToken: accessToken, | ||
email: context.user_name + "+" + context.user_id + "@" + context.auth_source, | ||
}; | ||
callback(null, profile); | ||
} |
Oops, something went wrong.