Login: remove get sso if type oauth
This commit is contained in:
parent
61ae9c1a72
commit
6e3b5d0338
@ -44,16 +44,18 @@ app.use(
|
||||
})
|
||||
);
|
||||
|
||||
app.use(logger("dev", {
|
||||
stream: stream,
|
||||
skip: function (req, res) {
|
||||
if (req.url == '/health') {
|
||||
app.use(
|
||||
logger("dev", {
|
||||
stream: stream,
|
||||
skip: function (req, res) {
|
||||
if (req.url == "/health") {
|
||||
return true;
|
||||
} else {
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}));
|
||||
}
|
||||
},
|
||||
})
|
||||
);
|
||||
|
||||
app.get("*", async (req: ILoginRequest, res: Response, next) => {
|
||||
const { i18n, cookies, headers, query, t, url } = req;
|
||||
@ -79,7 +81,7 @@ app.get("*", async (req: ILoginRequest, res: Response, next) => {
|
||||
return next();
|
||||
}
|
||||
|
||||
initialState = await getInitialState(query);
|
||||
initialState = await getInitialState(query, isAuth);
|
||||
const hideAuthPage = initialState?.ssoSettings?.hideAuthPage;
|
||||
const ssoUrl = initialState?.capabilities?.ssoUrl;
|
||||
|
||||
|
@ -15,7 +15,6 @@ import { checkIsAuthenticated } from "@docspace/common/api/user";
|
||||
import { getClient, getScopeList } from "@docspace/common/api/oauth";
|
||||
import { TenantStatus } from "@docspace/common/constants";
|
||||
import { IScope } from "@docspace/common/utils/oauth/interfaces";
|
||||
import winston, { stream } from "../logger";
|
||||
|
||||
export const getAssets = (): assetsType => {
|
||||
const manifest = fs.readFileSync(
|
||||
@ -49,7 +48,8 @@ export const loadPath = (language: string, nameSpace: string): string => {
|
||||
};
|
||||
|
||||
export const getInitialState = async (
|
||||
query: MatchType
|
||||
query: MatchType,
|
||||
isAuth: boolean
|
||||
): Promise<IInitialState> => {
|
||||
let portalSettings: IPortalSettings,
|
||||
buildInfo: IBuildInfo,
|
||||
@ -66,11 +66,9 @@ export const getInitialState = async (
|
||||
getLogoUrls(),
|
||||
];
|
||||
|
||||
const settings = [
|
||||
getAuthProviders(),
|
||||
getCapabilities(),
|
||||
// getCurrentSsoSettings(),
|
||||
];
|
||||
const settings = [getAuthProviders(), getCapabilities()];
|
||||
|
||||
if (!isAuth) settings.push(getCurrentSsoSettings());
|
||||
|
||||
[portalSettings, buildInfo, availableThemes, logoUrls] = await Promise.all(
|
||||
baseSettings
|
||||
@ -104,30 +102,6 @@ export const getOAuthState = async (
|
||||
): Promise<IOAuthState> => {
|
||||
const requests = [];
|
||||
|
||||
try {
|
||||
await getClient(clientId, isAuth);
|
||||
} catch (e) {
|
||||
console.log("get client");
|
||||
console.log(e);
|
||||
winston.error(e);
|
||||
}
|
||||
|
||||
try {
|
||||
await getUser();
|
||||
} catch (e) {
|
||||
console.log("get user");
|
||||
console.log(e);
|
||||
winston.error(e);
|
||||
}
|
||||
|
||||
try {
|
||||
await getScopeList();
|
||||
} catch (e) {
|
||||
console.log("get scopes");
|
||||
console.log(e);
|
||||
winston.error(e);
|
||||
}
|
||||
|
||||
requests.push(getClient(clientId, isAuth));
|
||||
|
||||
if (isAuth) {
|
||||
|
Loading…
Reference in New Issue
Block a user