void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) { writer.WriteStartObject(); writer.WritePropertyName("identityType"); writer.WriteStringValue(IdentityType.ToString()); writer.WriteEndObject(); }
/// <summary> /// </summary> /// <param name="item"> /// </param> protected void Trade(IdentityType container, int slotNumber) { IItem temp = this.GetCharacter().BaseInventory.Pages[(int)container][slotNumber]; // TODO: Remove item from Character's inventory and check against script reqs LogUtil.Debug( DebugInfoDetail.KnuBot, string.Format("KnuBut Trade item in container {0} slot {1}", container.ToString(), slotNumber)); }
public ICollection <Claim> GetUserClaims() { var claims = new List <Claim>(); claims.Add(new Claim(SaleManagementClaimTypes.Version, CurrentClaimsVersion.ToString())); claims.Add(new Claim(ClaimTypes.NameIdentifier, Id)); claims.Add(new Claim(ClaimTypes.Name, Name)); claims.Add(new Claim(SaleManagementClaimTypes.CompanyId, CompanyId.ToString())); claims.Add(new Claim(SaleManagementClaimTypes.IdentityType, IdentityType.ToString())); return(claims); }
/// <summary> /// Constructs the resource /// </summary> private JToken GetResource() { if (this.AssignIdentity != null && this.AssignIdentity.IsPresent) { this.IdentityType = ManagedIdentityType.SystemAssigned; } ResourceIdentity identityObject = this.IdentityType != null ? (this.IdentityType == ManagedIdentityType.UserAssigned ? new ResourceIdentity { Type = IdentityType.ToString(), UserAssignedIdentities = new Dictionary <string, UserAssignedIdentityResource> { { this.IdentityId, new UserAssignedIdentityResource { } } } } : new ResourceIdentity { Type = IdentityType.ToString() } ) : null; var policyassignmentObject = new PolicyAssignment { Name = this.Name, Identity = identityObject, Location = this.Location, Properties = new PolicyAssignmentProperties { DisplayName = this.DisplayName ?? null, Description = this.Description ?? null, Scope = this.Scope, NotScopes = this.NotScope ?? null, Metadata = this.Metadata == null ? null : this.GetObjectFromParameter(this.Metadata, nameof(this.Metadata)), EnforcementMode = EnforcementMode ?? PolicyAssignmentEnforcementMode.Default, Parameters = this.GetParameters(this.PolicyParameter, this.PolicyParameterObject), NonComplianceMessages = this.NonComplianceMessage?.Where(message => message != null).SelectArray(message => message.ToModel()) } }; if (this.PolicyDefinition != null) { policyassignmentObject.Properties.PolicyDefinitionId = this.PolicyDefinition.PolicyDefinitionId; } else if (this.PolicySetDefinition != null) { policyassignmentObject.Properties.PolicyDefinitionId = this.PolicySetDefinition.PolicySetDefinitionId; } return(policyassignmentObject.ToJToken()); }
public ClaimsIdentity ToClaimsIdentity() { return(new ClaimsIdentity(new Claim[] { new Claim(ClaimTypes.Sid, UserId.ToString()), new Claim(ClaimTypes.Name, UserName), new Claim(ClaimTypes.GroupSid, TenantId.ToString()), new Claim(ClaimTypes.GivenName, TenantName), new Claim(ClaimTypes.NameIdentifier, UserType.ToString()), new Claim(ClaimTypes.Locality, IdentityType.ToString()), new Claim(ClaimTypes.System, FuncModule.ToString()), })); }
public Dictionary <string, string> ToDictionary() { return(new Dictionary <string, string>() { { ClaimTypes.Sid, UserId.ToString() }, { ClaimTypes.Name, UserName }, { ClaimTypes.GroupSid, TenantId.ToString() }, { ClaimTypes.GivenName, TenantName }, { ClaimTypes.NameIdentifier, UserType.ToString() }, { ClaimTypes.Locality, IdentityType.ToString() }, { ClaimTypes.System, FuncModule.ToString() } }); }
public override string ToString() { switch (IdentityType) { case ProcessModelIdentityType.LocalSystem: case ProcessModelIdentityType.LocalService: case ProcessModelIdentityType.NetworkService: return(IdentityType.ToString()); case ProcessModelIdentityType.ApplicationPoolIdentity: return($"IIS AppPool\\{ParentElement["name"]}"); case ProcessModelIdentityType.SpecificUser: return(this.UserName); default: throw new ArgumentOutOfRangeException(); } }
void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) { writer.WriteStartObject(); if (Optional.IsDefined(ClientId)) { if (ClientId != null) { writer.WritePropertyName("clientId"); writer.WriteStringValue(ClientId.Value); } else { writer.WriteNull("clientId"); } } if (Optional.IsDefined(ObjectId)) { if (ObjectId != null) { writer.WritePropertyName("objectId"); writer.WriteStringValue(ObjectId.Value); } else { writer.WriteNull("objectId"); } } if (Optional.IsDefined(ResourceId)) { if (ResourceId != null) { writer.WritePropertyName("resourceId"); writer.WriteStringValue(ResourceId); } else { writer.WriteNull("resourceId"); } } writer.WritePropertyName("identityType"); writer.WriteStringValue(IdentityType.ToString()); writer.WriteEndObject(); }
private void button1_Click(object sender, EventArgs e) { string op_id = textBox1.Text; string op_pwd = textBox2.Text; string ad_server = textBox3.Text; string target_uid = textBox4.Text; IdentityType type = (IdentityType)Enum.Parse(typeof(IdentityType), comboBox1.SelectedItem.ToString()); bool exist = IsADUserExist(op_id, op_pwd, ad_server, type, target_uid); string msg = string.Format("目標 [{0}] ({1}) ", target_uid, type.ToString()); if (exist) { MessageBox.Show(msg + "存在"); } else { MessageBox.Show(msg + string.Format("在 AD Server [{0}] 找不到", ad_server)); } }
public void SetIdentityType(IdentityType value) { IdentityType = value.ToString(); }
//private void PushToLoggly(Level level, string identity, IdentityType identityType, string message, Exception exception, object logData = null) //{ // StackFrame StacFrame = new StackFrame(3); // MethodBase CallingMethod = StacFrame.GetMethod(); // string AssemblyMethodName = CallingMethod.Name; // string AssemblyName = CallingMethod.DeclaringType.Name; // string AssemblyFullName = CallingMethod.DeclaringType.FullName; // JObject UserData = logData == null ? new JObject() : JObject.Parse(JsonConvert.SerializeObject(logData)); // UserData["Level"] = level.ToString(); // UserData["EventTime"] = DateTime.UtcNow.ToString("yyyy-MM-dd HH:mm:ss:ffff"); // UserData["IdentityType"] = identityType.ToString(); // UserData["Identity"] = identity; // UserData["Assembly"] = AssemblyFullName; // UserData["Method"] = AssemblyMethodName; // if (!string.IsNullOrWhiteSpace(message)) // { // UserData["Message"] = message; // } // if (exception != null) // { // UserData["ExceptionType"] = exception.GetType().ToString(); // UserData["ExceptionMessage"] = exception.Message; // UserData["ExceptionStackTrace"] = exception.StackTrace; // } // JSONPost(JsonConvert.SerializeObject(UserData), LogglyURL + LogglyKey); //} private void PushToLog4Net(Level level, string identity, IdentityType identityType, string message, Exception exception, object logData = null) { string JSONString = ""; try { JSONString = logData != null ? "; JSONData=" + JsonConvert.SerializeObject(logData) : ""; } catch (Exception excp) { } MDC.Set("Identity", identity); MDC.Set("IdentityType", identityType.ToString()); MDC.Set("IPAddress", _HostIP); DefLogger.Log(typeof(MXLogger), level, message + JSONString, exception); MDC.Remove("Identity"); MDC.Remove("IdentityType"); MDC.Remove("IPAddress"); }
/// <summary> /// Constructs the resource /// </summary> private JToken GetResource(string resourceId, string apiVersion) { var resource = this.GetExistingResource(resourceId, apiVersion).Result.ToResource <PolicyAssignmentProperties>(); // get incoming object properties if present JObject inputMetadata = null; if (this.InputObject != null) { var newProperties = this.InputObject.Properties.ToJToken(); inputMetadata = newProperties["metadata"] as JObject; } var parameterMetadata = this.Metadata != null?this.GetObjectFromParameter(this.Metadata, nameof(this.Metadata)) : null; PolicyAssignmentEnforcementMode?inputMode = null; if (Enum.TryParse(this.InputObject?.Properties?.EnforcementMode?.ToString(), true, out PolicyAssignmentEnforcementMode tempMode1)) { inputMode = tempMode1; } // Grab the non-compliance messages from the parameter or input object or existing resource var nonComplianceMessages = this.NonComplianceMessage?.Where(message => message != null).SelectArray(message => message.ToModel()); if (nonComplianceMessages == null && this.InputObject?.Properties.NonComplianceMessages != null) { nonComplianceMessages = this.InputObject.Properties.NonComplianceMessages.Where(message => message != null).SelectArray(message => message.ToModel()); } else if (nonComplianceMessages == null) { nonComplianceMessages = resource.Properties.NonComplianceMessages; } if (this.AssignIdentity != null && this.AssignIdentity.IsPresent) { this.IdentityType = ManagedIdentityType.SystemAssigned; } ResourceIdentity identityObject = this.IdentityType != null ? (this.IdentityType == ManagedIdentityType.UserAssigned ? new ResourceIdentity { Type = IdentityType.ToString(), UserAssignedIdentities = new Dictionary <string, UserAssignedIdentityResource> { { this.IdentityId, new UserAssignedIdentityResource { } } } } : new ResourceIdentity { Type = IdentityType.ToString() } ) : null; var policyAssignmentObject = new PolicyAssignment { Name = this.Name ?? this.InputObject?.Name ?? resource.Name, Identity = identityObject, Location = this.Location ?? this.InputObject?.Location ?? resource.Location, Properties = new PolicyAssignmentProperties { DisplayName = this.DisplayName ?? this.InputObject?.Properties?.DisplayName ?? resource.Properties.DisplayName, Description = this.Description ?? this.InputObject?.Properties?.Description ?? resource.Properties.Description, Scope = resource.Properties.Scope, NotScopes = this.NotScope ?? this.InputObject?.Properties?.NotScopes ?? resource.Properties.NotScopes, PolicyDefinitionId = resource.Properties.PolicyDefinitionId, Metadata = parameterMetadata ?? inputMetadata ?? resource.Properties.Metadata, EnforcementMode = this.EnforcementMode ?? inputMode ?? resource.Properties.EnforcementMode, NonComplianceMessages = nonComplianceMessages, Parameters = this.GetParameters(this.PolicyParameter, this.PolicyParameterObject) ?? this.InputObject?.Properties?.Parameters?.ToResourcePropertiesBody() as JObject ?? resource.Properties.Parameters } }; return(policyAssignmentObject.ToJToken()); }