@primerouting/zitadel-node
Version:
Library for API access to ZITADEL. Provides compiled gRPC service clients and helpers for applications and service accounts. Support http2 self-hosted instances
1,193 lines (1,192 loc) • 71.7 kB
JavaScript
"use strict";
// Code generated by protoc-gen-ts_proto. DO NOT EDIT.
// versions:
// protoc-gen-ts_proto v1.181.1
// protoc unknown
// source: zitadel/policy.proto
var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.NotificationPolicy = exports.PrivacyPolicy = exports.LockoutPolicy = exports.PasswordAgePolicy = exports.PasswordComplexityPolicy = exports.LoginPolicy = exports.LabelPolicy = exports.DomainPolicy = exports.OrgIAMPolicy = exports.PasswordlessType = exports.MultiFactorType = exports.SecondFactorType = exports.ThemeMode = exports.protobufPackage = void 0;
exports.themeModeFromJSON = themeModeFromJSON;
exports.themeModeToJSON = themeModeToJSON;
exports.secondFactorTypeFromJSON = secondFactorTypeFromJSON;
exports.secondFactorTypeToJSON = secondFactorTypeToJSON;
exports.multiFactorTypeFromJSON = multiFactorTypeFromJSON;
exports.multiFactorTypeToJSON = multiFactorTypeToJSON;
exports.passwordlessTypeFromJSON = passwordlessTypeFromJSON;
exports.passwordlessTypeToJSON = passwordlessTypeToJSON;
/* eslint-disable */
const long_1 = __importDefault(require("long"));
const minimal_1 = __importDefault(require("protobufjs/minimal"));
const duration_1 = require("../google/protobuf/duration");
const idp_1 = require("./idp");
const object_1 = require("./object");
exports.protobufPackage = "zitadel.policy.v1";
var ThemeMode;
(function (ThemeMode) {
ThemeMode[ThemeMode["THEME_MODE_UNSPECIFIED"] = 0] = "THEME_MODE_UNSPECIFIED";
ThemeMode[ThemeMode["THEME_MODE_AUTO"] = 1] = "THEME_MODE_AUTO";
ThemeMode[ThemeMode["THEME_MODE_DARK"] = 2] = "THEME_MODE_DARK";
ThemeMode[ThemeMode["THEME_MODE_LIGHT"] = 3] = "THEME_MODE_LIGHT";
ThemeMode[ThemeMode["UNRECOGNIZED"] = -1] = "UNRECOGNIZED";
})(ThemeMode || (exports.ThemeMode = ThemeMode = {}));
function themeModeFromJSON(object) {
switch (object) {
case 0:
case "THEME_MODE_UNSPECIFIED":
return ThemeMode.THEME_MODE_UNSPECIFIED;
case 1:
case "THEME_MODE_AUTO":
return ThemeMode.THEME_MODE_AUTO;
case 2:
case "THEME_MODE_DARK":
return ThemeMode.THEME_MODE_DARK;
case 3:
case "THEME_MODE_LIGHT":
return ThemeMode.THEME_MODE_LIGHT;
case -1:
case "UNRECOGNIZED":
default:
return ThemeMode.UNRECOGNIZED;
}
}
function themeModeToJSON(object) {
switch (object) {
case ThemeMode.THEME_MODE_UNSPECIFIED:
return "THEME_MODE_UNSPECIFIED";
case ThemeMode.THEME_MODE_AUTO:
return "THEME_MODE_AUTO";
case ThemeMode.THEME_MODE_DARK:
return "THEME_MODE_DARK";
case ThemeMode.THEME_MODE_LIGHT:
return "THEME_MODE_LIGHT";
case ThemeMode.UNRECOGNIZED:
default:
return "UNRECOGNIZED";
}
}
var SecondFactorType;
(function (SecondFactorType) {
SecondFactorType[SecondFactorType["SECOND_FACTOR_TYPE_UNSPECIFIED"] = 0] = "SECOND_FACTOR_TYPE_UNSPECIFIED";
/** SECOND_FACTOR_TYPE_OTP - SECOND_FACTOR_TYPE_OTP is the type for TOTP */
SecondFactorType[SecondFactorType["SECOND_FACTOR_TYPE_OTP"] = 1] = "SECOND_FACTOR_TYPE_OTP";
SecondFactorType[SecondFactorType["SECOND_FACTOR_TYPE_U2F"] = 2] = "SECOND_FACTOR_TYPE_U2F";
SecondFactorType[SecondFactorType["SECOND_FACTOR_TYPE_OTP_EMAIL"] = 3] = "SECOND_FACTOR_TYPE_OTP_EMAIL";
SecondFactorType[SecondFactorType["SECOND_FACTOR_TYPE_OTP_SMS"] = 4] = "SECOND_FACTOR_TYPE_OTP_SMS";
SecondFactorType[SecondFactorType["UNRECOGNIZED"] = -1] = "UNRECOGNIZED";
})(SecondFactorType || (exports.SecondFactorType = SecondFactorType = {}));
function secondFactorTypeFromJSON(object) {
switch (object) {
case 0:
case "SECOND_FACTOR_TYPE_UNSPECIFIED":
return SecondFactorType.SECOND_FACTOR_TYPE_UNSPECIFIED;
case 1:
case "SECOND_FACTOR_TYPE_OTP":
return SecondFactorType.SECOND_FACTOR_TYPE_OTP;
case 2:
case "SECOND_FACTOR_TYPE_U2F":
return SecondFactorType.SECOND_FACTOR_TYPE_U2F;
case 3:
case "SECOND_FACTOR_TYPE_OTP_EMAIL":
return SecondFactorType.SECOND_FACTOR_TYPE_OTP_EMAIL;
case 4:
case "SECOND_FACTOR_TYPE_OTP_SMS":
return SecondFactorType.SECOND_FACTOR_TYPE_OTP_SMS;
case -1:
case "UNRECOGNIZED":
default:
return SecondFactorType.UNRECOGNIZED;
}
}
function secondFactorTypeToJSON(object) {
switch (object) {
case SecondFactorType.SECOND_FACTOR_TYPE_UNSPECIFIED:
return "SECOND_FACTOR_TYPE_UNSPECIFIED";
case SecondFactorType.SECOND_FACTOR_TYPE_OTP:
return "SECOND_FACTOR_TYPE_OTP";
case SecondFactorType.SECOND_FACTOR_TYPE_U2F:
return "SECOND_FACTOR_TYPE_U2F";
case SecondFactorType.SECOND_FACTOR_TYPE_OTP_EMAIL:
return "SECOND_FACTOR_TYPE_OTP_EMAIL";
case SecondFactorType.SECOND_FACTOR_TYPE_OTP_SMS:
return "SECOND_FACTOR_TYPE_OTP_SMS";
case SecondFactorType.UNRECOGNIZED:
default:
return "UNRECOGNIZED";
}
}
var MultiFactorType;
(function (MultiFactorType) {
MultiFactorType[MultiFactorType["MULTI_FACTOR_TYPE_UNSPECIFIED"] = 0] = "MULTI_FACTOR_TYPE_UNSPECIFIED";
MultiFactorType[MultiFactorType["MULTI_FACTOR_TYPE_U2F_WITH_VERIFICATION"] = 1] = "MULTI_FACTOR_TYPE_U2F_WITH_VERIFICATION";
MultiFactorType[MultiFactorType["UNRECOGNIZED"] = -1] = "UNRECOGNIZED";
})(MultiFactorType || (exports.MultiFactorType = MultiFactorType = {}));
function multiFactorTypeFromJSON(object) {
switch (object) {
case 0:
case "MULTI_FACTOR_TYPE_UNSPECIFIED":
return MultiFactorType.MULTI_FACTOR_TYPE_UNSPECIFIED;
case 1:
case "MULTI_FACTOR_TYPE_U2F_WITH_VERIFICATION":
return MultiFactorType.MULTI_FACTOR_TYPE_U2F_WITH_VERIFICATION;
case -1:
case "UNRECOGNIZED":
default:
return MultiFactorType.UNRECOGNIZED;
}
}
function multiFactorTypeToJSON(object) {
switch (object) {
case MultiFactorType.MULTI_FACTOR_TYPE_UNSPECIFIED:
return "MULTI_FACTOR_TYPE_UNSPECIFIED";
case MultiFactorType.MULTI_FACTOR_TYPE_U2F_WITH_VERIFICATION:
return "MULTI_FACTOR_TYPE_U2F_WITH_VERIFICATION";
case MultiFactorType.UNRECOGNIZED:
default:
return "UNRECOGNIZED";
}
}
var PasswordlessType;
(function (PasswordlessType) {
PasswordlessType[PasswordlessType["PASSWORDLESS_TYPE_NOT_ALLOWED"] = 0] = "PASSWORDLESS_TYPE_NOT_ALLOWED";
/** PASSWORDLESS_TYPE_ALLOWED - PLANNED: PASSWORDLESS_TYPE_WITH_CERT */
PasswordlessType[PasswordlessType["PASSWORDLESS_TYPE_ALLOWED"] = 1] = "PASSWORDLESS_TYPE_ALLOWED";
PasswordlessType[PasswordlessType["UNRECOGNIZED"] = -1] = "UNRECOGNIZED";
})(PasswordlessType || (exports.PasswordlessType = PasswordlessType = {}));
function passwordlessTypeFromJSON(object) {
switch (object) {
case 0:
case "PASSWORDLESS_TYPE_NOT_ALLOWED":
return PasswordlessType.PASSWORDLESS_TYPE_NOT_ALLOWED;
case 1:
case "PASSWORDLESS_TYPE_ALLOWED":
return PasswordlessType.PASSWORDLESS_TYPE_ALLOWED;
case -1:
case "UNRECOGNIZED":
default:
return PasswordlessType.UNRECOGNIZED;
}
}
function passwordlessTypeToJSON(object) {
switch (object) {
case PasswordlessType.PASSWORDLESS_TYPE_NOT_ALLOWED:
return "PASSWORDLESS_TYPE_NOT_ALLOWED";
case PasswordlessType.PASSWORDLESS_TYPE_ALLOWED:
return "PASSWORDLESS_TYPE_ALLOWED";
case PasswordlessType.UNRECOGNIZED:
default:
return "UNRECOGNIZED";
}
}
function createBaseOrgIAMPolicy() {
return { details: undefined, userLoginMustBeDomain: false, isDefault: false };
}
exports.OrgIAMPolicy = {
encode(message, writer = minimal_1.default.Writer.create()) {
if (message.details !== undefined) {
object_1.ObjectDetails.encode(message.details, writer.uint32(10).fork()).ldelim();
}
if (message.userLoginMustBeDomain !== false) {
writer.uint32(16).bool(message.userLoginMustBeDomain);
}
if (message.isDefault !== false) {
writer.uint32(24).bool(message.isDefault);
}
return writer;
},
decode(input, length) {
const reader = input instanceof minimal_1.default.Reader ? input : minimal_1.default.Reader.create(input);
let end = length === undefined ? reader.len : reader.pos + length;
const message = createBaseOrgIAMPolicy();
while (reader.pos < end) {
const tag = reader.uint32();
switch (tag >>> 3) {
case 1:
if (tag !== 10) {
break;
}
message.details = object_1.ObjectDetails.decode(reader, reader.uint32());
continue;
case 2:
if (tag !== 16) {
break;
}
message.userLoginMustBeDomain = reader.bool();
continue;
case 3:
if (tag !== 24) {
break;
}
message.isDefault = reader.bool();
continue;
}
if ((tag & 7) === 4 || tag === 0) {
break;
}
reader.skipType(tag & 7);
}
return message;
},
fromJSON(object) {
return {
details: isSet(object.details) ? object_1.ObjectDetails.fromJSON(object.details) : undefined,
userLoginMustBeDomain: isSet(object.userLoginMustBeDomain)
? globalThis.Boolean(object.userLoginMustBeDomain)
: false,
isDefault: isSet(object.isDefault) ? globalThis.Boolean(object.isDefault) : false,
};
},
toJSON(message) {
const obj = {};
if (message.details !== undefined) {
obj.details = object_1.ObjectDetails.toJSON(message.details);
}
if (message.userLoginMustBeDomain !== false) {
obj.userLoginMustBeDomain = message.userLoginMustBeDomain;
}
if (message.isDefault !== false) {
obj.isDefault = message.isDefault;
}
return obj;
},
create(base) {
return exports.OrgIAMPolicy.fromPartial(base ?? {});
},
fromPartial(object) {
const message = createBaseOrgIAMPolicy();
message.details = (object.details !== undefined && object.details !== null)
? object_1.ObjectDetails.fromPartial(object.details)
: undefined;
message.userLoginMustBeDomain = object.userLoginMustBeDomain ?? false;
message.isDefault = object.isDefault ?? false;
return message;
},
};
function createBaseDomainPolicy() {
return {
details: undefined,
userLoginMustBeDomain: false,
isDefault: false,
validateOrgDomains: false,
smtpSenderAddressMatchesInstanceDomain: false,
};
}
exports.DomainPolicy = {
encode(message, writer = minimal_1.default.Writer.create()) {
if (message.details !== undefined) {
object_1.ObjectDetails.encode(message.details, writer.uint32(10).fork()).ldelim();
}
if (message.userLoginMustBeDomain !== false) {
writer.uint32(16).bool(message.userLoginMustBeDomain);
}
if (message.isDefault !== false) {
writer.uint32(24).bool(message.isDefault);
}
if (message.validateOrgDomains !== false) {
writer.uint32(32).bool(message.validateOrgDomains);
}
if (message.smtpSenderAddressMatchesInstanceDomain !== false) {
writer.uint32(40).bool(message.smtpSenderAddressMatchesInstanceDomain);
}
return writer;
},
decode(input, length) {
const reader = input instanceof minimal_1.default.Reader ? input : minimal_1.default.Reader.create(input);
let end = length === undefined ? reader.len : reader.pos + length;
const message = createBaseDomainPolicy();
while (reader.pos < end) {
const tag = reader.uint32();
switch (tag >>> 3) {
case 1:
if (tag !== 10) {
break;
}
message.details = object_1.ObjectDetails.decode(reader, reader.uint32());
continue;
case 2:
if (tag !== 16) {
break;
}
message.userLoginMustBeDomain = reader.bool();
continue;
case 3:
if (tag !== 24) {
break;
}
message.isDefault = reader.bool();
continue;
case 4:
if (tag !== 32) {
break;
}
message.validateOrgDomains = reader.bool();
continue;
case 5:
if (tag !== 40) {
break;
}
message.smtpSenderAddressMatchesInstanceDomain = reader.bool();
continue;
}
if ((tag & 7) === 4 || tag === 0) {
break;
}
reader.skipType(tag & 7);
}
return message;
},
fromJSON(object) {
return {
details: isSet(object.details) ? object_1.ObjectDetails.fromJSON(object.details) : undefined,
userLoginMustBeDomain: isSet(object.userLoginMustBeDomain)
? globalThis.Boolean(object.userLoginMustBeDomain)
: false,
isDefault: isSet(object.isDefault) ? globalThis.Boolean(object.isDefault) : false,
validateOrgDomains: isSet(object.validateOrgDomains) ? globalThis.Boolean(object.validateOrgDomains) : false,
smtpSenderAddressMatchesInstanceDomain: isSet(object.smtpSenderAddressMatchesInstanceDomain)
? globalThis.Boolean(object.smtpSenderAddressMatchesInstanceDomain)
: false,
};
},
toJSON(message) {
const obj = {};
if (message.details !== undefined) {
obj.details = object_1.ObjectDetails.toJSON(message.details);
}
if (message.userLoginMustBeDomain !== false) {
obj.userLoginMustBeDomain = message.userLoginMustBeDomain;
}
if (message.isDefault !== false) {
obj.isDefault = message.isDefault;
}
if (message.validateOrgDomains !== false) {
obj.validateOrgDomains = message.validateOrgDomains;
}
if (message.smtpSenderAddressMatchesInstanceDomain !== false) {
obj.smtpSenderAddressMatchesInstanceDomain = message.smtpSenderAddressMatchesInstanceDomain;
}
return obj;
},
create(base) {
return exports.DomainPolicy.fromPartial(base ?? {});
},
fromPartial(object) {
const message = createBaseDomainPolicy();
message.details = (object.details !== undefined && object.details !== null)
? object_1.ObjectDetails.fromPartial(object.details)
: undefined;
message.userLoginMustBeDomain = object.userLoginMustBeDomain ?? false;
message.isDefault = object.isDefault ?? false;
message.validateOrgDomains = object.validateOrgDomains ?? false;
message.smtpSenderAddressMatchesInstanceDomain = object.smtpSenderAddressMatchesInstanceDomain ?? false;
return message;
},
};
function createBaseLabelPolicy() {
return {
details: undefined,
primaryColor: "",
isDefault: false,
hideLoginNameSuffix: false,
warnColor: "",
backgroundColor: "",
fontColor: "",
primaryColorDark: "",
backgroundColorDark: "",
warnColorDark: "",
fontColorDark: "",
disableWatermark: false,
logoUrl: "",
iconUrl: "",
logoUrlDark: "",
iconUrlDark: "",
fontUrl: "",
themeMode: 0,
};
}
exports.LabelPolicy = {
encode(message, writer = minimal_1.default.Writer.create()) {
if (message.details !== undefined) {
object_1.ObjectDetails.encode(message.details, writer.uint32(10).fork()).ldelim();
}
if (message.primaryColor !== "") {
writer.uint32(18).string(message.primaryColor);
}
if (message.isDefault !== false) {
writer.uint32(32).bool(message.isDefault);
}
if (message.hideLoginNameSuffix !== false) {
writer.uint32(40).bool(message.hideLoginNameSuffix);
}
if (message.warnColor !== "") {
writer.uint32(50).string(message.warnColor);
}
if (message.backgroundColor !== "") {
writer.uint32(58).string(message.backgroundColor);
}
if (message.fontColor !== "") {
writer.uint32(66).string(message.fontColor);
}
if (message.primaryColorDark !== "") {
writer.uint32(74).string(message.primaryColorDark);
}
if (message.backgroundColorDark !== "") {
writer.uint32(82).string(message.backgroundColorDark);
}
if (message.warnColorDark !== "") {
writer.uint32(90).string(message.warnColorDark);
}
if (message.fontColorDark !== "") {
writer.uint32(98).string(message.fontColorDark);
}
if (message.disableWatermark !== false) {
writer.uint32(104).bool(message.disableWatermark);
}
if (message.logoUrl !== "") {
writer.uint32(114).string(message.logoUrl);
}
if (message.iconUrl !== "") {
writer.uint32(122).string(message.iconUrl);
}
if (message.logoUrlDark !== "") {
writer.uint32(130).string(message.logoUrlDark);
}
if (message.iconUrlDark !== "") {
writer.uint32(138).string(message.iconUrlDark);
}
if (message.fontUrl !== "") {
writer.uint32(146).string(message.fontUrl);
}
if (message.themeMode !== 0) {
writer.uint32(152).int32(message.themeMode);
}
return writer;
},
decode(input, length) {
const reader = input instanceof minimal_1.default.Reader ? input : minimal_1.default.Reader.create(input);
let end = length === undefined ? reader.len : reader.pos + length;
const message = createBaseLabelPolicy();
while (reader.pos < end) {
const tag = reader.uint32();
switch (tag >>> 3) {
case 1:
if (tag !== 10) {
break;
}
message.details = object_1.ObjectDetails.decode(reader, reader.uint32());
continue;
case 2:
if (tag !== 18) {
break;
}
message.primaryColor = reader.string();
continue;
case 4:
if (tag !== 32) {
break;
}
message.isDefault = reader.bool();
continue;
case 5:
if (tag !== 40) {
break;
}
message.hideLoginNameSuffix = reader.bool();
continue;
case 6:
if (tag !== 50) {
break;
}
message.warnColor = reader.string();
continue;
case 7:
if (tag !== 58) {
break;
}
message.backgroundColor = reader.string();
continue;
case 8:
if (tag !== 66) {
break;
}
message.fontColor = reader.string();
continue;
case 9:
if (tag !== 74) {
break;
}
message.primaryColorDark = reader.string();
continue;
case 10:
if (tag !== 82) {
break;
}
message.backgroundColorDark = reader.string();
continue;
case 11:
if (tag !== 90) {
break;
}
message.warnColorDark = reader.string();
continue;
case 12:
if (tag !== 98) {
break;
}
message.fontColorDark = reader.string();
continue;
case 13:
if (tag !== 104) {
break;
}
message.disableWatermark = reader.bool();
continue;
case 14:
if (tag !== 114) {
break;
}
message.logoUrl = reader.string();
continue;
case 15:
if (tag !== 122) {
break;
}
message.iconUrl = reader.string();
continue;
case 16:
if (tag !== 130) {
break;
}
message.logoUrlDark = reader.string();
continue;
case 17:
if (tag !== 138) {
break;
}
message.iconUrlDark = reader.string();
continue;
case 18:
if (tag !== 146) {
break;
}
message.fontUrl = reader.string();
continue;
case 19:
if (tag !== 152) {
break;
}
message.themeMode = reader.int32();
continue;
}
if ((tag & 7) === 4 || tag === 0) {
break;
}
reader.skipType(tag & 7);
}
return message;
},
fromJSON(object) {
return {
details: isSet(object.details) ? object_1.ObjectDetails.fromJSON(object.details) : undefined,
primaryColor: isSet(object.primaryColor) ? globalThis.String(object.primaryColor) : "",
isDefault: isSet(object.isDefault) ? globalThis.Boolean(object.isDefault) : false,
hideLoginNameSuffix: isSet(object.hideLoginNameSuffix) ? globalThis.Boolean(object.hideLoginNameSuffix) : false,
warnColor: isSet(object.warnColor) ? globalThis.String(object.warnColor) : "",
backgroundColor: isSet(object.backgroundColor) ? globalThis.String(object.backgroundColor) : "",
fontColor: isSet(object.fontColor) ? globalThis.String(object.fontColor) : "",
primaryColorDark: isSet(object.primaryColorDark) ? globalThis.String(object.primaryColorDark) : "",
backgroundColorDark: isSet(object.backgroundColorDark) ? globalThis.String(object.backgroundColorDark) : "",
warnColorDark: isSet(object.warnColorDark) ? globalThis.String(object.warnColorDark) : "",
fontColorDark: isSet(object.fontColorDark) ? globalThis.String(object.fontColorDark) : "",
disableWatermark: isSet(object.disableWatermark) ? globalThis.Boolean(object.disableWatermark) : false,
logoUrl: isSet(object.logoUrl) ? globalThis.String(object.logoUrl) : "",
iconUrl: isSet(object.iconUrl) ? globalThis.String(object.iconUrl) : "",
logoUrlDark: isSet(object.logoUrlDark) ? globalThis.String(object.logoUrlDark) : "",
iconUrlDark: isSet(object.iconUrlDark) ? globalThis.String(object.iconUrlDark) : "",
fontUrl: isSet(object.fontUrl) ? globalThis.String(object.fontUrl) : "",
themeMode: isSet(object.themeMode) ? themeModeFromJSON(object.themeMode) : 0,
};
},
toJSON(message) {
const obj = {};
if (message.details !== undefined) {
obj.details = object_1.ObjectDetails.toJSON(message.details);
}
if (message.primaryColor !== "") {
obj.primaryColor = message.primaryColor;
}
if (message.isDefault !== false) {
obj.isDefault = message.isDefault;
}
if (message.hideLoginNameSuffix !== false) {
obj.hideLoginNameSuffix = message.hideLoginNameSuffix;
}
if (message.warnColor !== "") {
obj.warnColor = message.warnColor;
}
if (message.backgroundColor !== "") {
obj.backgroundColor = message.backgroundColor;
}
if (message.fontColor !== "") {
obj.fontColor = message.fontColor;
}
if (message.primaryColorDark !== "") {
obj.primaryColorDark = message.primaryColorDark;
}
if (message.backgroundColorDark !== "") {
obj.backgroundColorDark = message.backgroundColorDark;
}
if (message.warnColorDark !== "") {
obj.warnColorDark = message.warnColorDark;
}
if (message.fontColorDark !== "") {
obj.fontColorDark = message.fontColorDark;
}
if (message.disableWatermark !== false) {
obj.disableWatermark = message.disableWatermark;
}
if (message.logoUrl !== "") {
obj.logoUrl = message.logoUrl;
}
if (message.iconUrl !== "") {
obj.iconUrl = message.iconUrl;
}
if (message.logoUrlDark !== "") {
obj.logoUrlDark = message.logoUrlDark;
}
if (message.iconUrlDark !== "") {
obj.iconUrlDark = message.iconUrlDark;
}
if (message.fontUrl !== "") {
obj.fontUrl = message.fontUrl;
}
if (message.themeMode !== 0) {
obj.themeMode = themeModeToJSON(message.themeMode);
}
return obj;
},
create(base) {
return exports.LabelPolicy.fromPartial(base ?? {});
},
fromPartial(object) {
const message = createBaseLabelPolicy();
message.details = (object.details !== undefined && object.details !== null)
? object_1.ObjectDetails.fromPartial(object.details)
: undefined;
message.primaryColor = object.primaryColor ?? "";
message.isDefault = object.isDefault ?? false;
message.hideLoginNameSuffix = object.hideLoginNameSuffix ?? false;
message.warnColor = object.warnColor ?? "";
message.backgroundColor = object.backgroundColor ?? "";
message.fontColor = object.fontColor ?? "";
message.primaryColorDark = object.primaryColorDark ?? "";
message.backgroundColorDark = object.backgroundColorDark ?? "";
message.warnColorDark = object.warnColorDark ?? "";
message.fontColorDark = object.fontColorDark ?? "";
message.disableWatermark = object.disableWatermark ?? false;
message.logoUrl = object.logoUrl ?? "";
message.iconUrl = object.iconUrl ?? "";
message.logoUrlDark = object.logoUrlDark ?? "";
message.iconUrlDark = object.iconUrlDark ?? "";
message.fontUrl = object.fontUrl ?? "";
message.themeMode = object.themeMode ?? 0;
return message;
},
};
function createBaseLoginPolicy() {
return {
details: undefined,
allowUsernamePassword: false,
allowRegister: false,
allowExternalIdp: false,
forceMfa: false,
passwordlessType: 0,
isDefault: false,
hidePasswordReset: false,
ignoreUnknownUsernames: false,
defaultRedirectUri: "",
passwordCheckLifetime: undefined,
externalLoginCheckLifetime: undefined,
mfaInitSkipLifetime: undefined,
secondFactorCheckLifetime: undefined,
multiFactorCheckLifetime: undefined,
secondFactors: [],
multiFactors: [],
idps: [],
allowDomainDiscovery: false,
disableLoginWithEmail: false,
disableLoginWithPhone: false,
forceMfaLocalOnly: false,
};
}
exports.LoginPolicy = {
encode(message, writer = minimal_1.default.Writer.create()) {
if (message.details !== undefined) {
object_1.ObjectDetails.encode(message.details, writer.uint32(10).fork()).ldelim();
}
if (message.allowUsernamePassword !== false) {
writer.uint32(16).bool(message.allowUsernamePassword);
}
if (message.allowRegister !== false) {
writer.uint32(24).bool(message.allowRegister);
}
if (message.allowExternalIdp !== false) {
writer.uint32(32).bool(message.allowExternalIdp);
}
if (message.forceMfa !== false) {
writer.uint32(40).bool(message.forceMfa);
}
if (message.passwordlessType !== 0) {
writer.uint32(48).int32(message.passwordlessType);
}
if (message.isDefault !== false) {
writer.uint32(56).bool(message.isDefault);
}
if (message.hidePasswordReset !== false) {
writer.uint32(64).bool(message.hidePasswordReset);
}
if (message.ignoreUnknownUsernames !== false) {
writer.uint32(72).bool(message.ignoreUnknownUsernames);
}
if (message.defaultRedirectUri !== "") {
writer.uint32(82).string(message.defaultRedirectUri);
}
if (message.passwordCheckLifetime !== undefined) {
duration_1.Duration.encode(message.passwordCheckLifetime, writer.uint32(90).fork()).ldelim();
}
if (message.externalLoginCheckLifetime !== undefined) {
duration_1.Duration.encode(message.externalLoginCheckLifetime, writer.uint32(98).fork()).ldelim();
}
if (message.mfaInitSkipLifetime !== undefined) {
duration_1.Duration.encode(message.mfaInitSkipLifetime, writer.uint32(106).fork()).ldelim();
}
if (message.secondFactorCheckLifetime !== undefined) {
duration_1.Duration.encode(message.secondFactorCheckLifetime, writer.uint32(114).fork()).ldelim();
}
if (message.multiFactorCheckLifetime !== undefined) {
duration_1.Duration.encode(message.multiFactorCheckLifetime, writer.uint32(122).fork()).ldelim();
}
writer.uint32(130).fork();
for (const v of message.secondFactors) {
writer.int32(v);
}
writer.ldelim();
writer.uint32(138).fork();
for (const v of message.multiFactors) {
writer.int32(v);
}
writer.ldelim();
for (const v of message.idps) {
idp_1.IDPLoginPolicyLink.encode(v, writer.uint32(146).fork()).ldelim();
}
if (message.allowDomainDiscovery !== false) {
writer.uint32(152).bool(message.allowDomainDiscovery);
}
if (message.disableLoginWithEmail !== false) {
writer.uint32(160).bool(message.disableLoginWithEmail);
}
if (message.disableLoginWithPhone !== false) {
writer.uint32(168).bool(message.disableLoginWithPhone);
}
if (message.forceMfaLocalOnly !== false) {
writer.uint32(176).bool(message.forceMfaLocalOnly);
}
return writer;
},
decode(input, length) {
const reader = input instanceof minimal_1.default.Reader ? input : minimal_1.default.Reader.create(input);
let end = length === undefined ? reader.len : reader.pos + length;
const message = createBaseLoginPolicy();
while (reader.pos < end) {
const tag = reader.uint32();
switch (tag >>> 3) {
case 1:
if (tag !== 10) {
break;
}
message.details = object_1.ObjectDetails.decode(reader, reader.uint32());
continue;
case 2:
if (tag !== 16) {
break;
}
message.allowUsernamePassword = reader.bool();
continue;
case 3:
if (tag !== 24) {
break;
}
message.allowRegister = reader.bool();
continue;
case 4:
if (tag !== 32) {
break;
}
message.allowExternalIdp = reader.bool();
continue;
case 5:
if (tag !== 40) {
break;
}
message.forceMfa = reader.bool();
continue;
case 6:
if (tag !== 48) {
break;
}
message.passwordlessType = reader.int32();
continue;
case 7:
if (tag !== 56) {
break;
}
message.isDefault = reader.bool();
continue;
case 8:
if (tag !== 64) {
break;
}
message.hidePasswordReset = reader.bool();
continue;
case 9:
if (tag !== 72) {
break;
}
message.ignoreUnknownUsernames = reader.bool();
continue;
case 10:
if (tag !== 82) {
break;
}
message.defaultRedirectUri = reader.string();
continue;
case 11:
if (tag !== 90) {
break;
}
message.passwordCheckLifetime = duration_1.Duration.decode(reader, reader.uint32());
continue;
case 12:
if (tag !== 98) {
break;
}
message.externalLoginCheckLifetime = duration_1.Duration.decode(reader, reader.uint32());
continue;
case 13:
if (tag !== 106) {
break;
}
message.mfaInitSkipLifetime = duration_1.Duration.decode(reader, reader.uint32());
continue;
case 14:
if (tag !== 114) {
break;
}
message.secondFactorCheckLifetime = duration_1.Duration.decode(reader, reader.uint32());
continue;
case 15:
if (tag !== 122) {
break;
}
message.multiFactorCheckLifetime = duration_1.Duration.decode(reader, reader.uint32());
continue;
case 16:
if (tag === 128) {
message.secondFactors.push(reader.int32());
continue;
}
if (tag === 130) {
const end2 = reader.uint32() + reader.pos;
while (reader.pos < end2) {
message.secondFactors.push(reader.int32());
}
continue;
}
break;
case 17:
if (tag === 136) {
message.multiFactors.push(reader.int32());
continue;
}
if (tag === 138) {
const end2 = reader.uint32() + reader.pos;
while (reader.pos < end2) {
message.multiFactors.push(reader.int32());
}
continue;
}
break;
case 18:
if (tag !== 146) {
break;
}
message.idps.push(idp_1.IDPLoginPolicyLink.decode(reader, reader.uint32()));
continue;
case 19:
if (tag !== 152) {
break;
}
message.allowDomainDiscovery = reader.bool();
continue;
case 20:
if (tag !== 160) {
break;
}
message.disableLoginWithEmail = reader.bool();
continue;
case 21:
if (tag !== 168) {
break;
}
message.disableLoginWithPhone = reader.bool();
continue;
case 22:
if (tag !== 176) {
break;
}
message.forceMfaLocalOnly = reader.bool();
continue;
}
if ((tag & 7) === 4 || tag === 0) {
break;
}
reader.skipType(tag & 7);
}
return message;
},
fromJSON(object) {
return {
details: isSet(object.details) ? object_1.ObjectDetails.fromJSON(object.details) : undefined,
allowUsernamePassword: isSet(object.allowUsernamePassword)
? globalThis.Boolean(object.allowUsernamePassword)
: false,
allowRegister: isSet(object.allowRegister) ? globalThis.Boolean(object.allowRegister) : false,
allowExternalIdp: isSet(object.allowExternalIdp) ? globalThis.Boolean(object.allowExternalIdp) : false,
forceMfa: isSet(object.forceMfa) ? globalThis.Boolean(object.forceMfa) : false,
passwordlessType: isSet(object.passwordlessType) ? passwordlessTypeFromJSON(object.passwordlessType) : 0,
isDefault: isSet(object.isDefault) ? globalThis.Boolean(object.isDefault) : false,
hidePasswordReset: isSet(object.hidePasswordReset) ? globalThis.Boolean(object.hidePasswordReset) : false,
ignoreUnknownUsernames: isSet(object.ignoreUnknownUsernames)
? globalThis.Boolean(object.ignoreUnknownUsernames)
: false,
defaultRedirectUri: isSet(object.defaultRedirectUri) ? globalThis.String(object.defaultRedirectUri) : "",
passwordCheckLifetime: isSet(object.passwordCheckLifetime)
? duration_1.Duration.fromJSON(object.passwordCheckLifetime)
: undefined,
externalLoginCheckLifetime: isSet(object.externalLoginCheckLifetime)
? duration_1.Duration.fromJSON(object.externalLoginCheckLifetime)
: undefined,
mfaInitSkipLifetime: isSet(object.mfaInitSkipLifetime)
? duration_1.Duration.fromJSON(object.mfaInitSkipLifetime)
: undefined,
secondFactorCheckLifetime: isSet(object.secondFactorCheckLifetime)
? duration_1.Duration.fromJSON(object.secondFactorCheckLifetime)
: undefined,
multiFactorCheckLifetime: isSet(object.multiFactorCheckLifetime)
? duration_1.Duration.fromJSON(object.multiFactorCheckLifetime)
: undefined,
secondFactors: globalThis.Array.isArray(object?.secondFactors)
? object.secondFactors.map((e) => secondFactorTypeFromJSON(e))
: [],
multiFactors: globalThis.Array.isArray(object?.multiFactors)
? object.multiFactors.map((e) => multiFactorTypeFromJSON(e))
: [],
idps: globalThis.Array.isArray(object?.idps)
? object.idps.map((e) => idp_1.IDPLoginPolicyLink.fromJSON(e))
: [],
allowDomainDiscovery: isSet(object.allowDomainDiscovery)
? globalThis.Boolean(object.allowDomainDiscovery)
: false,
disableLoginWithEmail: isSet(object.disableLoginWithEmail)
? globalThis.Boolean(object.disableLoginWithEmail)
: false,
disableLoginWithPhone: isSet(object.disableLoginWithPhone)
? globalThis.Boolean(object.disableLoginWithPhone)
: false,
forceMfaLocalOnly: isSet(object.forceMfaLocalOnly) ? globalThis.Boolean(object.forceMfaLocalOnly) : false,
};
},
toJSON(message) {
const obj = {};
if (message.details !== undefined) {
obj.details = object_1.ObjectDetails.toJSON(message.details);
}
if (message.allowUsernamePassword !== false) {
obj.allowUsernamePassword = message.allowUsernamePassword;
}
if (message.allowRegister !== false) {
obj.allowRegister = message.allowRegister;
}
if (message.allowExternalIdp !== false) {
obj.allowExternalIdp = message.allowExternalIdp;
}
if (message.forceMfa !== false) {
obj.forceMfa = message.forceMfa;
}
if (message.passwordlessType !== 0) {
obj.passwordlessType = passwordlessTypeToJSON(message.passwordlessType);
}
if (message.isDefault !== false) {
obj.isDefault = message.isDefault;
}
if (message.hidePasswordReset !== false) {
obj.hidePasswordReset = message.hidePasswordReset;
}
if (message.ignoreUnknownUsernames !== false) {
obj.ignoreUnknownUsernames = message.ignoreUnknownUsernames;
}
if (message.defaultRedirectUri !== "") {
obj.defaultRedirectUri = message.defaultRedirectUri;
}
if (message.passwordCheckLifetime !== undefined) {
obj.passwordCheckLifetime = duration_1.Duration.toJSON(message.passwordCheckLifetime);
}
if (message.externalLoginCheckLifetime !== undefined) {
obj.externalLoginCheckLifetime = duration_1.Duration.toJSON(message.externalLoginCheckLifetime);
}
if (message.mfaInitSkipLifetime !== undefined) {
obj.mfaInitSkipLifetime = duration_1.Duration.toJSON(message.mfaInitSkipLifetime);
}
if (message.secondFactorCheckLifetime !== undefined) {
obj.secondFactorCheckLifetime = duration_1.Duration.toJSON(message.secondFactorCheckLifetime);
}
if (message.multiFactorCheckLifetime !== undefined) {
obj.multiFactorCheckLifetime = duration_1.Duration.toJSON(message.multiFactorCheckLifetime);
}
if (message.secondFactors?.length) {
obj.secondFactors = message.secondFactors.map((e) => secondFactorTypeToJSON(e));
}
if (message.multiFactors?.length) {
obj.multiFactors = message.multiFactors.map((e) => multiFactorTypeToJSON(e));
}
if (message.idps?.length) {
obj.idps = message.idps.map((e) => idp_1.IDPLoginPolicyLink.toJSON(e));
}
if (message.allowDomainDiscovery !== false) {
obj.allowDomainDiscovery = message.allowDomainDiscovery;
}
if (message.disableLoginWithEmail !== false) {
obj.disableLoginWithEmail = message.disableLoginWithEmail;
}
if (message.disableLoginWithPhone !== false) {
obj.disableLoginWithPhone = message.disableLoginWithPhone;
}
if (message.forceMfaLocalOnly !== false) {
obj.forceMfaLocalOnly = message.forceMfaLocalOnly;
}
return obj;
},
create(base) {
return exports.LoginPolicy.fromPartial(base ?? {});
},
fromPartial(object) {
const message = createBaseLoginPolicy();
message.details = (object.details !== undefined && object.details !== null)
? object_1.ObjectDetails.fromPartial(object.details)
: undefined;
message.allowUsernamePassword = object.allowUsernamePassword ?? false;
message.allowRegister = object.allowRegister ?? false;
message.allowExternalIdp = object.allowExternalIdp ?? false;
message.forceMfa = object.forceMfa ?? false;
message.passwordlessType = object.passwordlessType ?? 0;
message.isDefault = object.isDefault ?? false;
message.hidePasswordReset = object.hidePasswordReset ?? false;
message.ignoreUnknownUsernames = object.ignoreUnknownUsernames ?? false;
message.defaultRedirectUri = object.defaultRedirectUri ?? "";
message.passwordCheckLifetime =
(object.passwordCheckLifetime !== undefined && object.passwordCheckLifetime !== null)
? duration_1.Duration.fromPartial(object.passwordCheckLifetime)
: undefined;
message.externalLoginCheckLifetime =
(object.externalLoginCheckLifetime !== undefined && object.externalLoginCheckLifetime !== null)
? duration_1.Duration.fromPartial(object.externalLoginCheckLifetime)
: undefined;
message.mfaInitSkipLifetime = (object.mfaInitSkipLifetime !== undefined && object.mfaInitSkipLifetime !== null)
? duration_1.Duration.fromPartial(object.mfaInitSkipLifetime)
: undefined;
message.secondFactorCheckLifetime =
(object.secondFactorCheckLifetime !== undefined && object.secondFactorCheckLifetime !== null)
? duration_1.Duration.fromPartial(object.secondFactorCheckLifetime)
: undefined;
message.multiFactorCheckLifetime =
(object.multiFactorCheckLifetime !== undefined && object.multiFactorCheckLifetime !== null)
? duration_1.Duration.fromPartial(object.multiFactorCheckLifetime)
: undefined;
message.secondFactors = object.secondFactors?.map((e) => e) || [];
message.multiFactors = object.multiFactors?.map((e) => e) || [];
message.idps = object.idps?.map((e) => idp_1.IDPLoginPolicyLink.fromPartial(e)) || [];
message.allowDomainDiscovery = object.allowDomainDiscovery ?? false;
message.disableLoginWithEmail = object.disableLoginWithEmail ?? false;
message.disableLoginWithPhone = object.disableLoginWithPhone ?? false;
message.forceMfaLocalOnly = object.forceMfaLocalOnly ?? false;
return message;
},
};
function createBasePasswordComplexityPolicy() {
return {
details: undefined,
minLength: long_1.default.UZERO,
hasUppercase: false,
hasLowercase: false,
hasNumber: false,
hasSymbol: false,
isDefault: false,
};
}
exports.PasswordComplexityPolicy = {
encode(message, writer = minimal_1.default.Writer.create()) {
if (message.details !== undefined) {
object_1.ObjectDetails.encode(message.details, writer.uint32(10).fork()).ldelim();
}
if (!message.minLength.equals(long_1.default.UZERO)) {
writer.uint32(16).uint64(message.minLength);
}
if (message.hasUppercase !== false) {
writer.uint32(24).bool(message.hasUppercase);
}
if (message.hasLowercase !== false) {
writer.uint32(32).bool(message.hasLowercase);
}
if (message.hasNumber !== false) {
writer.uint32(40).bool(message.hasNumber);
}
if (message.hasSymbol !== false) {
writer.uint32(48).bool(message.hasSymbol);
}
if (message.isDefault !== false) {
writer.uint32(56).bool(message.isDefault);
}
return writer;
},
decode(input, length) {
const reader = input instanceof minimal_1.default.Reader ? input : minimal_1.default.Reader.create(input);
let end = length === undefined ? reader.len : reader.pos + length;
const message = createBasePasswordComplexityPolicy();
while (reader.pos < end) {
const tag = reader.uint32();
switch (tag >>> 3) {
case 1:
if (tag !== 10) {
break;
}
message.details = object_1.ObjectDetails.decode(reader, reader.uint32());
continue;
case 2:
if (tag !== 16) {
break;
}
message.minLength = reader.uint64();
continue;
case 3:
if (tag !== 24) {
break;
}
message.hasUppercase = reader.bool();
continue;
case 4:
if (tag !== 32) {
break;
}
message.hasLowercase = reader.bool();