@boxyhq/saml-jackson 0.3.2-beta.297 → 0.3.2-beta.301

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -212,7 +212,17 @@ class OAuthController {
212
212
  if (!codeVal || !codeVal.profile) {
213
213
  throw new error_1.JacksonError('Invalid code', 403);
214
214
  }
215
- if (client_id && client_secret) {
215
+ if (code_verifier) {
216
+ // PKCE flow
217
+ let cv = code_verifier;
218
+ if (codeVal.session.code_challenge_method.toLowerCase() === 's256') {
219
+ cv = codeVerifier.encode(code_verifier);
220
+ }
221
+ if (codeVal.session.code_challenge !== cv) {
222
+ throw new error_1.JacksonError('Invalid code_verifier', 401);
223
+ }
224
+ }
225
+ else if (client_id && client_secret) {
216
226
  // check if we have an encoded client_id
217
227
  if (client_id !== 'dummy' && client_secret !== 'dummy') {
218
228
  const sp = getEncodedClientId(client_id);
@@ -224,16 +234,6 @@ class OAuthController {
224
234
  }
225
235
  }
226
236
  }
227
- else if (code_verifier) {
228
- // PKCE flow
229
- let cv = code_verifier;
230
- if (codeVal.session.code_challenge_method.toLowerCase() === 's256') {
231
- cv = codeVerifier.encode(code_verifier);
232
- }
233
- if (codeVal.session.code_challenge !== cv) {
234
- throw new error_1.JacksonError('Invalid code_verifier', 401);
235
- }
236
- }
237
237
  else if (codeVal && codeVal.session) {
238
238
  throw new error_1.JacksonError('Please specify client_secret or code_verifier', 401);
239
239
  }
@@ -1,5 +1,3 @@
1
- import { Request } from 'express';
2
- export declare const extractAuthToken: (req: Request) => string | null;
3
1
  export declare enum IndexNames {
4
2
  EntityID = "entityID",
5
3
  TenantProduct = "tenantProduct"
@@ -1,15 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.IndexNames = exports.extractAuthToken = void 0;
4
- const extractAuthToken = (req) => {
5
- const authHeader = req.get('authorization');
6
- const parts = (authHeader || '').split(' ');
7
- if (parts.length > 1) {
8
- return parts[1];
9
- }
10
- return null;
11
- };
12
- exports.extractAuthToken = extractAuthToken;
3
+ exports.IndexNames = void 0;
13
4
  var IndexNames;
14
5
  (function (IndexNames) {
15
6
  IndexNames["EntityID"] = "entityID";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@boxyhq/saml-jackson",
3
- "version": "0.3.2-beta.297",
3
+ "version": "0.3.2-beta.301",
4
4
  "description": "SAML 2.0 service",
5
5
  "keywords": [
6
6
  "SAML 2.0"