mirror of
https://gitlab.com/openstapps/openstapps.git
synced 2026-01-22 09:32:41 +00:00
fix: add PKCE parameters for PAIA auth
This commit is contained in:
@@ -22,6 +22,7 @@ import {
|
|||||||
StringMap,
|
StringMap,
|
||||||
AuthorizationError,
|
AuthorizationError,
|
||||||
AuthorizationErrorJson,
|
AuthorizationErrorJson,
|
||||||
|
BUILT_IN_PARAMETERS,
|
||||||
} from '@openid/appauth';
|
} from '@openid/appauth';
|
||||||
import {Browser} from 'ionic-appauth';
|
import {Browser} from 'ionic-appauth';
|
||||||
import {PAIAAuthorizationNotifier} from './paia-authorization-notifier';
|
import {PAIAAuthorizationNotifier} from './paia-authorization-notifier';
|
||||||
@@ -41,8 +42,6 @@ const AUTHORIZATION_REQUEST_HANDLE_KEY =
|
|||||||
'appauth_current_authorization_request';
|
'appauth_current_authorization_request';
|
||||||
export const AUTHORIZATION_RESPONSE_KEY = 'auth_response';
|
export const AUTHORIZATION_RESPONSE_KEY = 'auth_response';
|
||||||
|
|
||||||
// TODO: PAIA specific ...!!! use whatever you can from the parent class !
|
|
||||||
|
|
||||||
export class PAIAAuthorizationRequestHandler {
|
export class PAIAAuthorizationRequestHandler {
|
||||||
notifier: PAIAAuthorizationNotifier;
|
notifier: PAIAAuthorizationNotifier;
|
||||||
|
|
||||||
@@ -208,6 +207,18 @@ export class PAIAAuthorizationRequestHandler {
|
|||||||
scope: request.scope,
|
scope: request.scope,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
// copy over extras
|
||||||
|
if (request.extras) {
|
||||||
|
for (const extra in request.extras) {
|
||||||
|
if (
|
||||||
|
request.extras.hasOwnProperty(extra) && // check before inserting to requestMap
|
||||||
|
!BUILT_IN_PARAMETERS.includes(extra)
|
||||||
|
) {
|
||||||
|
requestMap[extra] = request.extras[extra];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
const query = this.utils.stringify(requestMap);
|
const query = this.utils.stringify(requestMap);
|
||||||
const baseUrl = configuration.authorizationEndpoint;
|
const baseUrl = configuration.authorizationEndpoint;
|
||||||
|
|
||||||
|
|||||||
@@ -65,7 +65,8 @@ export class PAIATokenRequestHandler {
|
|||||||
method: 'POST',
|
method: 'POST',
|
||||||
data: {
|
data: {
|
||||||
patron: request.patron,
|
patron: request.patron,
|
||||||
grant_type: 'client_credentials',
|
grant_type: 'authorization_code',
|
||||||
|
...request.toStringMap(),
|
||||||
},
|
},
|
||||||
headers: {
|
headers: {
|
||||||
'Authorization': `Basic ${request.code}`,
|
'Authorization': `Basic ${request.code}`,
|
||||||
|
|||||||
Reference in New Issue
Block a user