Skip to content

Commit

Permalink
ci: experiment with manually runnable ci with pre-set branchnames
Browse files Browse the repository at this point in the history
  • Loading branch information
porcellus committed Sep 26, 2024
1 parent bd7d733 commit 4b49700
Show file tree
Hide file tree
Showing 13 changed files with 49 additions and 29 deletions.
6 changes: 3 additions & 3 deletions .circleci/forceRunCI.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@ branch=`git rev-parse --abbrev-ref HEAD`

cdiCoreMap='{ "5.1": "feat/oauth-provider-base" }'
cdiPluginInterfaceMap='{ "5.1": "feat/oauth-provider-base" }'
fdiNodeMap='{ "3.1": "feat/oauth2/base" }'
fdiWebsiteMap='{ "3.1": "master" }'
fdiAuthReactMap='{ "3.1": "feat/oauth2/base" }'
fdiNodeMap='{ "3.1": "feat/oauth2/base", "4.0": "feat/oauth2/base" }'
fdiWebsiteMap='{ "3.1": "master", "4.0": "master" }'
fdiAuthReactMap='{ "3.1": "feat/oauth2/base", "4.0": "feat/oauth2/base" }'

data=`jq -cn --arg branch "$branch" \
--arg cdiCoreMap "$cdiCoreMap" \
Expand Down
2 changes: 1 addition & 1 deletion frontendDriverInterfaceSupported.json
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{
"_comment": "contains a list of frontend-driver interfaces branch names that this core supports",
"versions": ["1.17", "1.18", "1.19", "2.0", "3.0", "3.1"]
"versions": ["1.17", "1.18", "1.19", "2.0", "3.0", "3.1", "4.0"]
}
18 changes: 13 additions & 5 deletions lib/build/authUtils.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 0 additions & 2 deletions lib/build/querier.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions lib/build/recipe/session/recipe.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -64,4 +64,5 @@ export default class SessionRecipe extends RecipeModule {
accessToken: import("./jwt").ParsedJWTInfo | undefined;
allowedTransferMethod: import("./types").TokenTransferMethod | "any";
};
getNormalisedOverwriteSessionDuringSignInUp: (req: any) => boolean;
}
8 changes: 8 additions & 0 deletions lib/build/recipe/session/recipe.js
Original file line number Diff line number Diff line change
Expand Up @@ -193,6 +193,14 @@ class SessionRecipe extends recipeModule_1.default {
});
return sessionRequestFunctions_1.getAccessTokenFromRequest(req, allowedTransferMethod);
};
this.getNormalisedOverwriteSessionDuringSignInUp = (req) => {
var _a;
const supportsFDI31 = utils_2.hasGreaterThanEqualToFDI(req, "3.1");
const res =
(_a = this.config.overwriteSessionDuringSignInUp) !== null && _a !== void 0 ? _a : supportsFDI31;
logger_1.logDebugMessage("getNormalisedOverwriteSessionDuringSignInUp returning: " + res);
return res;
};
this.config = utils_1.validateAndNormaliseUserInput(this, appInfo, config);
const antiCsrfToLog =
typeof this.config.antiCsrfFunctionOrString === "string"
Expand Down
2 changes: 1 addition & 1 deletion lib/build/recipe/session/types.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ export declare type TypeNormalisedInput = {
cookieSecure: boolean;
sessionExpiredStatusCode: number;
errorHandlers: NormalisedErrorHandlers;
overwriteSessionDuringSignInUp: boolean;
overwriteSessionDuringSignInUp: boolean | undefined;
antiCsrfFunctionOrString:
| "VIA_TOKEN"
| "VIA_CUSTOM_HEADER"
Expand Down
11 changes: 4 additions & 7 deletions lib/build/recipe/session/utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ function getURLProtocol(url) {
}
exports.getURLProtocol = getURLProtocol;
function validateAndNormaliseUserInput(recipeInstance, appInfo, config) {
var _a, _b, _c, _d, _e;
var _a, _b, _c, _d;
let cookieDomain =
config === undefined || config.cookieDomain === undefined
? undefined
Expand Down Expand Up @@ -231,14 +231,11 @@ function validateAndNormaliseUserInput(recipeInstance, appInfo, config) {
override,
invalidClaimStatusCode,
overwriteSessionDuringSignInUp:
(_d = config === null || config === void 0 ? void 0 : config.overwriteSessionDuringSignInUp) !== null &&
config === null || config === void 0 ? void 0 : config.overwriteSessionDuringSignInUp,
jwksRefreshIntervalSec:
(_d = config === null || config === void 0 ? void 0 : config.jwksRefreshIntervalSec) !== null &&
_d !== void 0
? _d
: true,
jwksRefreshIntervalSec:
(_e = config === null || config === void 0 ? void 0 : config.jwksRefreshIntervalSec) !== null &&
_e !== void 0
? _e
: 3600 * 4,
};
}
Expand Down
13 changes: 8 additions & 5 deletions lib/ts/authUtils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -280,8 +280,9 @@ export const AuthUtils = {
// If the new user wasn't linked to the current one, we check the config and overwrite the session if required
// Note: we could also get here if MFA is enabled, but the app didn't want to link the user to the session user.
// This is intentional, since the MFA and overwriteSessionDuringSignInUp configs should work independently.
let overwriteSessionDuringSignInUp = SessionRecipe.getInstanceOrThrowError().config
.overwriteSessionDuringSignInUp;
let overwriteSessionDuringSignInUp = SessionRecipe.getInstanceOrThrowError().getNormalisedOverwriteSessionDuringSignInUp(
req
);
if (overwriteSessionDuringSignInUp) {
respSession = await Session.createNewSession(req, res, tenantId, recipeUserId, {}, {}, userContext);
if (mfaInstance !== undefined) {
Expand Down Expand Up @@ -1016,9 +1017,11 @@ export const AuthUtils = {
shouldTryLinkingWithSessionUser: boolean | undefined,
userContext: UserContext
) {
const overwriteSessionDuringSignInUp = SessionRecipe.getInstanceOrThrowError().config
.overwriteSessionDuringSignInUp;
return shouldTryLinkingWithSessionUser !== false || !overwriteSessionDuringSignInUp
const overwriteSessionDuringSignInUp = SessionRecipe.getInstanceOrThrowError().getNormalisedOverwriteSessionDuringSignInUp(
req
);

return shouldTryLinkingWithSessionUser !== false || overwriteSessionDuringSignInUp === false
? await Session.getSession(
req,
res,
Expand Down
2 changes: 0 additions & 2 deletions lib/ts/querier.ts
Original file line number Diff line number Diff line change
Expand Up @@ -344,7 +344,6 @@ export class Querier {
);
finalURL.search = searchParams.toString();

console.log("finalURL", finalURL.toString());
// Update cache and return
let response = await doFetch(finalURL.toString(), {
method: "GET",
Expand Down Expand Up @@ -612,7 +611,6 @@ export class Querier {
Querier.hostsAliveForTesting.add(currentDomain + currentBasePath);
}

console.log("response", { url, body: await response.clone().text(), headers: response.headers });
if (response.status !== 200) {
throw response;
}
Expand Down
9 changes: 8 additions & 1 deletion lib/ts/recipe/session/recipe.ts
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ import OpenIdRecipe from "../openid/recipe";
import { logDebugMessage } from "../../logger";
import { resetCombinedJWKS } from "../../combinedRemoteJWKSet";
import { getAccessTokenFromRequest } from "./sessionRequestFunctions";
import { isTestEnv } from "../../utils";
import { hasGreaterThanEqualToFDI, isTestEnv } from "../../utils";

// For Express
export default class SessionRecipe extends RecipeModule {
Expand Down Expand Up @@ -296,4 +296,11 @@ export default class SessionRecipe extends RecipeModule {

return getAccessTokenFromRequest(req, allowedTransferMethod);
};

getNormalisedOverwriteSessionDuringSignInUp = (req: any) => {
const supportsFDI31 = hasGreaterThanEqualToFDI(req, "3.1");
const res = this.config.overwriteSessionDuringSignInUp ?? supportsFDI31;
logDebugMessage("getNormalisedOverwriteSessionDuringSignInUp returning: " + res);
return res;
};
}
2 changes: 1 addition & 1 deletion lib/ts/recipe/session/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,7 @@ export type TypeNormalisedInput = {
cookieSecure: boolean;
sessionExpiredStatusCode: number;
errorHandlers: NormalisedErrorHandlers;
overwriteSessionDuringSignInUp: boolean;
overwriteSessionDuringSignInUp: boolean | undefined;

antiCsrfFunctionOrString:
| "VIA_TOKEN"
Expand Down
2 changes: 1 addition & 1 deletion lib/ts/recipe/session/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -303,7 +303,7 @@ export function validateAndNormaliseUserInput(
antiCsrfFunctionOrString: antiCsrf,
override,
invalidClaimStatusCode,
overwriteSessionDuringSignInUp: config?.overwriteSessionDuringSignInUp ?? true,
overwriteSessionDuringSignInUp: config?.overwriteSessionDuringSignInUp,
jwksRefreshIntervalSec: config?.jwksRefreshIntervalSec ?? 3600 * 4,
};
}
Expand Down

0 comments on commit 4b49700

Please sign in to comment.