internal AccessPolicyEntry(Guid tenantId, string objectId, Guid?applicationId, IdentityAccessPermissions permissions)
 {
     TenantId      = tenantId;
     ObjectId      = objectId;
     ApplicationId = applicationId;
     Permissions   = permissions;
 }
        public AccessPolicyEntry(Guid tenantId, string objectId, IdentityAccessPermissions permissions)
        {
            if (objectId == null)
            {
                throw new ArgumentNullException(nameof(objectId));
            }
            if (permissions == null)
            {
                throw new ArgumentNullException(nameof(permissions));
            }

            TenantId    = tenantId;
            ObjectId    = objectId;
            Permissions = permissions;
        }
Пример #3
0
        internal static VaultAccessPolicy DeserializeVaultAccessPolicy(JsonElement element)
        {
            Guid                      tenantId      = default;
            string                    objectId      = default;
            Optional <Guid>           applicationId = default;
            IdentityAccessPermissions permissions   = default;

            foreach (var property in element.EnumerateObject())
            {
                if (property.NameEquals("tenantId"))
                {
                    tenantId = property.Value.GetGuid();
                    continue;
                }
                if (property.NameEquals("objectId"))
                {
                    objectId = property.Value.GetString();
                    continue;
                }
                if (property.NameEquals("applicationId"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        property.ThrowNonNullablePropertyIsNull();
                        continue;
                    }
                    applicationId = property.Value.GetGuid();
                    continue;
                }
                if (property.NameEquals("permissions"))
                {
                    permissions = IdentityAccessPermissions.DeserializeIdentityAccessPermissions(property.Value);
                    continue;
                }
            }
            return(new VaultAccessPolicy(tenantId, objectId, Optional.ToNullable(applicationId), permissions));
        }