chore: update comments, remove debug logging

This commit is contained in:
Marcell Fülöp 2023-02-24 22:27:27 +00:00
parent 6f98fa61e4
commit df5ab361e3
2 changed files with 5 additions and 19 deletions

View File

@ -12,11 +12,6 @@ let router = express.Router({
mergeParams: true mergeParams: true
}); });
/**
* OAuth Authorization Code flow initialisation
*
* /api/oidc
*/
router router
.route('/') .route('/')
.options((req, res) => { .options((req, res) => {
@ -25,9 +20,9 @@ router
.all(jwtdecode()) .all(jwtdecode())
/** /**
* GET /api/users * GET /api/oidc
* *
* Retrieve all users * OAuth Authorization Code flow initialisation
*/ */
.get(jwtdecode(), async (req, res) => { .get(jwtdecode(), async (req, res) => {
console.log('oidc: init flow'); console.log('oidc: init flow');
@ -41,11 +36,6 @@ router
}); });
/**
* Oauth Authorization Code flow callback
*
* /api/oidc/callback
*/
router router
.route('/callback') .route('/callback')
.options((req, res) => { .options((req, res) => {
@ -54,9 +44,9 @@ router
.all(jwtdecode()) .all(jwtdecode())
/** /**
* GET /users/123 or /users/me * GET /api/oidc/callback
* *
* Retrieve a specific user * Oauth Authorization Code flow callback
*/ */
.get(jwtdecode(), async (req, res) => { .get(jwtdecode(), async (req, res) => {
console.log('oidc: callback'); console.log('oidc: callback');
@ -70,7 +60,7 @@ router
}); });
/** /**
* Executed discovery and returns the configured `openid-client` client * Executes discovery and returns the configured `openid-client` client
* *
* @param {Setting} row * @param {Setting} row
* */ * */

View File

@ -60,22 +60,18 @@ module.exports = Mn.View.extend({
expiry = v[1]; expiry = v[1];
} }
if (name === 'npm_oidc_error') { if (name === 'npm_oidc_error') {
console.log(' ERROR 000 > ', value);
error = decodeURIComponent(value); error = decodeURIComponent(value);
} }
} }
console.log('login.js event > render', expiry, token);
// register a newly acquired jwt token following successful oidc authentication // register a newly acquired jwt token following successful oidc authentication
if (token && expiry && (new Date(Date.parse(decodeURIComponent(expiry)))) > new Date() ) { if (token && expiry && (new Date(Date.parse(decodeURIComponent(expiry)))) > new Date() ) {
console.log('login.js event > render >>>');
Tokens.addToken(token); Tokens.addToken(token);
document.location.replace('/'); document.location.replace('/');
} }
// show error message following a failed oidc authentication // show error message following a failed oidc authentication
if (error) { if (error) {
console.log(' ERROR > ', error);
this.ui.oidcError.html(error); this.ui.oidcError.html(error);
} }