feat: scope login attempts to specific subdomains if available - do not switch subdomains (#3741)
* make the user lookup in user creator sensitive to team * add team specific logic to oidc strat * factor out slugifyDomain * change type of req during auth to Koa.Context
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
import env from "@shared/env";
|
||||
import { parseDomain, getCookieDomain } from "./domains";
|
||||
import { parseDomain, getCookieDomain, slugifyDomain } from "./domains";
|
||||
|
||||
// test suite is based on subset of parse-domain module we want to support
|
||||
// https://github.com/peerigon/parse-domain/blob/master/test/parseDomain.test.js
|
||||
@@ -158,6 +158,14 @@ describe("#parseDomain", () => {
|
||||
});
|
||||
});
|
||||
|
||||
describe("#slugifyDomain", () => {
|
||||
it("strips the last . delineated segment from strings", () => {
|
||||
expect(slugifyDomain("foo.co")).toBe("foo");
|
||||
expect(slugifyDomain("foo.co.uk")).toBe("foo-co");
|
||||
expect(slugifyDomain("www.foo.co.uk")).toBe("www-foo-co");
|
||||
});
|
||||
});
|
||||
|
||||
describe("#getCookieDomain", () => {
|
||||
beforeEach(() => {
|
||||
env.URL = "https://example.com";
|
||||
|
||||
Reference in New Issue
Block a user