MOBILE-4201 login: Add TypeOfLogin enum
parent
a0c0162b85
commit
a4d7ffeb5e
|
@ -2771,7 +2771,7 @@ export type CoreSitePublicConfigResponse = {
|
|||
maintenancemessage: string; // Maintenance message.
|
||||
logourl?: string; // The site logo URL.
|
||||
compactlogourl?: string; // The site compact logo URL.
|
||||
typeoflogin: number; // The type of login. 1 for app, 2 for browser, 3 for embedded.
|
||||
typeoflogin: TypeOfLogin; // The type of login. 1 for app, 2 for browser, 3 for embedded.
|
||||
launchurl?: string; // SSO login launch URL.
|
||||
mobilecssurl?: string; // Mobile custom CSS theme.
|
||||
// eslint-disable-next-line @typescript-eslint/naming-convention
|
||||
|
@ -2869,3 +2869,12 @@ enum OngoingRequestType {
|
|||
STANDARD = 0,
|
||||
UPDATE_IN_BACKGROUND = 1,
|
||||
}
|
||||
|
||||
/**
|
||||
* The type of login. 1 for app, 2 for browser, 3 for embedded.
|
||||
*/
|
||||
export enum TypeOfLogin {
|
||||
APP = 1,
|
||||
BROWSER = 2, // SSO in browser window is required.
|
||||
EMBEDDED = 3, // SSO in embedded browser is required.
|
||||
}
|
||||
|
|
|
@ -82,7 +82,13 @@ export class CoreConstants {
|
|||
static readonly WS_PREFIX = 'local_mobile_'; // @deprecated since app 4.0.
|
||||
|
||||
// Login constants.
|
||||
/**
|
||||
* @deprecated since 4.3 Use TypeOfLogin.BROWSER instead.
|
||||
*/
|
||||
static readonly LOGIN_SSO_CODE = 2; // SSO in browser window is required.
|
||||
/**
|
||||
* @deprecated since 4.3 Use TypeOfLogin.EMBEDDED instead.
|
||||
*/
|
||||
static readonly LOGIN_SSO_INAPP_CODE = 3; // SSO in embedded browser is required.
|
||||
static readonly LOGIN_LAUNCH_DATA = 'CoreLoginLaunchData';
|
||||
|
||||
|
|
|
@ -26,7 +26,7 @@ import { CoreTextUtils } from '@services/utils/text';
|
|||
import { CoreUrlParams, CoreUrlUtils } from '@services/utils/url';
|
||||
import { CoreUtils } from '@services/utils/utils';
|
||||
import { CoreConstants } from '@/core/constants';
|
||||
import { CoreSite, CoreSiteIdentityProvider, CoreSitePublicConfigResponse, CoreSiteQRCodeType } from '@classes/site';
|
||||
import { CoreSite, CoreSiteIdentityProvider, CoreSitePublicConfigResponse, CoreSiteQRCodeType, TypeOfLogin } from '@classes/site';
|
||||
import { CoreError } from '@classes/errors/error';
|
||||
import { CoreWSError } from '@classes/errors/wserror';
|
||||
import { DomSanitizer, makeSingleton, Translate } from '@singletons';
|
||||
|
@ -139,7 +139,7 @@ export class CoreLoginHelperProvider {
|
|||
* Open a browser to perform SSO login.
|
||||
*
|
||||
* @param siteUrl URL of the site where the SSO login will be performed.
|
||||
* @param typeOfLogin CoreConstants.LOGIN_SSO_CODE or CoreConstants.LOGIN_SSO_INAPP_CODE.
|
||||
* @param typeOfLogin TypeOfLogin.BROWSER or TypeOfLogin.EMBEDDED.
|
||||
* @param service The service to use. If not defined, core service will be used.
|
||||
* @param launchUrl The URL to open for SSO. If not defined, default tool mobile launch URL will be used.
|
||||
* @param redirectData Data of the path/url to open once authenticated. If not defined, site initial page.
|
||||
|
@ -148,7 +148,7 @@ export class CoreLoginHelperProvider {
|
|||
*/
|
||||
async confirmAndOpenBrowserForSSOLogin(
|
||||
siteUrl: string,
|
||||
typeOfLogin: number,
|
||||
typeOfLogin: TypeOfLogin,
|
||||
service?: string,
|
||||
launchUrl?: string,
|
||||
redirectData?: CoreRedirectPayload,
|
||||
|
@ -601,8 +601,8 @@ export class CoreLoginHelperProvider {
|
|||
* @param code Code to check.
|
||||
* @returns True if embedded browser, false othwerise.
|
||||
*/
|
||||
isSSOEmbeddedBrowser(code: number): boolean {
|
||||
return code == CoreConstants.LOGIN_SSO_INAPP_CODE;
|
||||
isSSOEmbeddedBrowser(code: TypeOfLogin): boolean {
|
||||
return code == TypeOfLogin.EMBEDDED;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -611,8 +611,8 @@ export class CoreLoginHelperProvider {
|
|||
* @param code Code to check.
|
||||
* @returns True if SSO login is needed, false othwerise.
|
||||
*/
|
||||
isSSOLoginNeeded(code: number): boolean {
|
||||
return code == CoreConstants.LOGIN_SSO_CODE || code == CoreConstants.LOGIN_SSO_INAPP_CODE;
|
||||
isSSOLoginNeeded(code: TypeOfLogin): boolean {
|
||||
return code == TypeOfLogin.BROWSER || code == TypeOfLogin.EMBEDDED;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -656,14 +656,14 @@ export class CoreLoginHelperProvider {
|
|||
* Open a browser to perform SSO login.
|
||||
*
|
||||
* @param siteUrl URL of the site where the SSO login will be performed.
|
||||
* @param typeOfLogin CoreConstants.LOGIN_SSO_CODE or CoreConstants.LOGIN_SSO_INAPP_CODE.
|
||||
* @param typeOfLogin TypeOfLogin.BROWSER or TypeOfLogin.EMBEDDED.
|
||||
* @param service The service to use. If not defined, core service will be used.
|
||||
* @param launchUrl The URL to open for SSO. If not defined, default tool mobile launch URL will be used.
|
||||
* @param redirectData Data of the path/url to open once authenticated. If not defined, site initial page.
|
||||
*/
|
||||
openBrowserForSSOLogin(
|
||||
siteUrl: string,
|
||||
typeOfLogin: number,
|
||||
typeOfLogin: TypeOfLogin,
|
||||
service?: string,
|
||||
launchUrl?: string,
|
||||
redirectData?: CoreRedirectPayload,
|
||||
|
@ -901,12 +901,12 @@ export class CoreLoginHelperProvider {
|
|||
/**
|
||||
* Check if a confirm should be shown to open a SSO authentication.
|
||||
*
|
||||
* @param typeOfLogin CoreConstants.LOGIN_SSO_CODE or CoreConstants.LOGIN_SSO_INAPP_CODE.
|
||||
* @param typeOfLogin TypeOfLogin.BROWSER or TypeOfLogin.EMBEDDED.
|
||||
* @returns True if confirm modal should be shown, false otherwise.
|
||||
* @deprecated since 4.3 Not used anymore.
|
||||
*/
|
||||
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
||||
shouldShowSSOConfirm(typeOfLogin: number): boolean {
|
||||
shouldShowSSOConfirm(typeOfLogin: TypeOfLogin): boolean {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue