Skip to content

fix: expose disableAuth property on Tenant #2909

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions package-lock.json

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

14 changes: 12 additions & 2 deletions src/auth/tenant.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ import { AuthClientErrorCode, FirebaseAuthError } from '../utils/error';
import {
EmailSignInConfig, EmailSignInConfigServerRequest, MultiFactorAuthServerConfig,
MultiFactorConfig, validateTestPhoneNumbers, EmailSignInProviderConfig,
MultiFactorAuthConfig, SmsRegionConfig, SmsRegionsAuthConfig, RecaptchaAuthConfig, RecaptchaConfig,
MultiFactorAuthConfig, SmsRegionConfig, SmsRegionsAuthConfig, RecaptchaAuthConfig, RecaptchaConfig,
RecaptchaAuthServerConfig, PasswordPolicyConfig,
PasswordPolicyAuthConfig, PasswordPolicyAuthServerConfig, EmailPrivacyConfig, EmailPrivacyAuthConfig,
} from './auth-config';
Expand Down Expand Up @@ -61,7 +61,7 @@ export interface UpdateTenantRequest {
* The SMS configuration to update on the project.
*/
smsRegionConfig?: SmsRegionConfig;

/**
* The reCAPTCHA configuration to update on the tenant.
* By enabling reCAPTCHA Enterprise integration, you are
Expand Down Expand Up @@ -103,6 +103,7 @@ export interface TenantServerResponse {
displayName?: string;
allowPasswordSignup?: boolean;
enableEmailLinkSignin?: boolean;
disableAuth?: boolean;
enableAnonymousUser?: boolean;
mfaConfig?: MultiFactorAuthServerConfig;
testPhoneNumbers?: {[key: string]: string};
Expand Down Expand Up @@ -144,6 +145,13 @@ export class Tenant {
*/
public readonly displayName?: string;

/**
* Whether authentication is disabled for the tenant.
* If true, the users under the disabled tenant are not allowed to sign-in.
* Admins of the disabled tenant are not able to manage its users.
*/
public readonly disableAuth: boolean

public readonly anonymousSignInEnabled: boolean;

/**
Expand Down Expand Up @@ -344,6 +352,7 @@ export class Tenant {
allowPasswordSignup: false,
});
}
this.disableAuth = !!response.disableAuth;
this.anonymousSignInEnabled = !!response.enableAnonymousUser;
if (typeof response.mfaConfig !== 'undefined') {
this.multiFactorConfig_ = new MultiFactorAuthConfig(response.mfaConfig);
Expand Down Expand Up @@ -397,6 +406,7 @@ export class Tenant {
displayName: this.displayName,
emailSignInConfig: this.emailSignInConfig_?.toJSON(),
multiFactorConfig: this.multiFactorConfig_?.toJSON(),
disableAuth: this.disableAuth,
anonymousSignInEnabled: this.anonymousSignInEnabled,
testPhoneNumbers: this.testPhoneNumbers,
smsRegionConfig: deepCopy(this.smsRegionConfig),
Expand Down