[CORL-621] Auth Fixes (#2569)

* fix: resolve error with redirects

- fixes #2529

* fix: apply validations to username for oidc

* fix: converted components to function components

* fix: snapshots
This commit is contained in:
Wyatt Johnson
2019-09-18 14:01:06 -04:00
committed by Kim Gardner
parent 64f102e6d4
commit 921461008e
28 changed files with 567 additions and 555 deletions
@@ -22,6 +22,7 @@ import { AsymmetricSigningAlgorithm } from "coral-server/services/jwt";
import TenantCache from "coral-server/services/tenant/cache";
import { TenantCacheAdapter } from "coral-server/services/tenant/cache/adapter";
import { insert } from "coral-server/services/users";
import { validateUsername } from "coral-server/services/users/helpers";
import { Request } from "coral-server/types/express";
export interface Params {
@@ -170,7 +171,14 @@ export async function findOrCreateOIDCUser(
// FIXME: implement rules.
// Try to extract the username from the following chain:
const username = preferred_username || nickname || name;
let username = preferred_username || nickname || name;
if (username) {
try {
validateUsername(username);
} catch (err) {
username = undefined;
}
}
// Create the new user, as one didn't exist before!
user = await insert(
@@ -422,7 +422,6 @@ type LocalAuthIntegration {
integration should be displayed in all targets.
"""
targetFilter: AuthenticationTargetFilter!
}
##########################
@@ -443,13 +442,6 @@ type SSOAuthIntegration {
"""
allowRegistration: Boolean!
"""
redirectURL is the URL that the user should be redirected to in order to start
an authentication flow with the given integration. This field is not stored,
and is instead computed from the Tenant.
"""
redirectURL: String
"""
targetFilter will restrict where the authentication integration should be
displayed. If the value of targetFilter is null, then the authentication