/// <summary> /// Gets the user id from the XacmlContextRequest subject attribute /// </summary> /// <param name="request">The Xacml Context Request</param> /// <returns>The user id of the subject</returns> public int GetSubjectUserId(XacmlContextRequest request) { XacmlContextAttributes subjectContextAttributes = request.GetSubjectAttributes(); XacmlAttribute subjectAttribute = subjectContextAttributes.Attributes.FirstOrDefault(a => a.AttributeId.OriginalString.Equals(XacmlRequestAttribute.UserAttribute)); return(Convert.ToInt32(subjectAttribute?.AttributeValues.FirstOrDefault()?.Value)); }
private async Task EnrichSubjectAttributes(XacmlContextRequest request, string resourceParty) { // If there is no resource party then it is impossible to enrich roles if (string.IsNullOrEmpty(resourceParty)) { return; } XacmlContextAttributes subjectContextAttributes = request.GetSubjectAttributes(); int subjectUserId = 0; int resourcePartyId = Convert.ToInt32(resourceParty); foreach (XacmlAttribute xacmlAttribute in subjectContextAttributes.Attributes) { if (xacmlAttribute.AttributeId.OriginalString.Equals(_userAttributeId)) { subjectUserId = Convert.ToInt32(xacmlAttribute.AttributeValues.First().Value); } } if (subjectUserId == 0) { return; } List <Role> roleList = await GetDecisionPointRolesForUser(subjectUserId, resourcePartyId) ?? new List <Role>(); subjectContextAttributes.Attributes.Add(GetRoleAttribute(roleList)); }
private static void ConvertCategoryAttributes(List <XacmlJsonCategory> categoryList, string categoryId, ICollection <XacmlContextAttributes> contextAttributes) { if (categoryList == null) { return; } foreach (XacmlJsonCategory subjectCategory in categoryList) { if (!string.IsNullOrEmpty(subjectCategory.CategoryId)) { categoryId = subjectCategory.CategoryId; } XacmlContextAttributes xacmlContextAttributes = new XacmlContextAttributes(new Uri(categoryId)); XacmlAttribute xacmlAttribute = null; ICollection <XacmlAttributeValue> attributeValues = new Collection <XacmlAttributeValue>(); foreach (XacmlJsonAttribute jsonAttribute in subjectCategory.Attribute) { if (xacmlAttribute == null) { xacmlAttribute = new XacmlAttribute(new Uri(jsonAttribute.AttributeId), jsonAttribute.IncludeInResult); } XacmlAttributeValue xacmlAttributeValue = new XacmlAttributeValue(new Uri(ConvertDataType(jsonAttribute)), jsonAttribute.Value); xacmlAttribute.AttributeValues.Add(xacmlAttributeValue); xacmlContextAttributes.Attributes.Add(xacmlAttribute); } contextAttributes.Add(xacmlContextAttributes); } }
private XacmlResourceAttributes GetResourceAttributeValues(XacmlContextAttributes resourceContextAttributes) { XacmlResourceAttributes resourceAttributes = new XacmlResourceAttributes(); foreach (XacmlAttribute attribute in resourceContextAttributes.Attributes) { if (attribute.AttributeId.OriginalString.Equals(XacmlRequestAttribute.OrgAttribute)) { resourceAttributes.OrgValue = attribute.AttributeValues.First().Value; } if (attribute.AttributeId.OriginalString.Equals(XacmlRequestAttribute.AppAttribute)) { resourceAttributes.AppValue = attribute.AttributeValues.First().Value; } if (attribute.AttributeId.OriginalString.Equals(XacmlRequestAttribute.InstanceAttribute)) { resourceAttributes.InstanceValue = attribute.AttributeValues.First().Value; } if (attribute.AttributeId.OriginalString.Equals(XacmlRequestAttribute.PartyAttribute)) { resourceAttributes.ResourcePartyValue = attribute.AttributeValues.First().Value; } if (attribute.AttributeId.OriginalString.Equals(XacmlRequestAttribute.TaskAttribute)) { resourceAttributes.TaskValue = attribute.AttributeValues.First().Value; } } return(resourceAttributes); }
private async Task EnrichResourceAttributes(XacmlContextRequest request) { XacmlContextAttributes resourceContextAttributes = request.GetResourceAttributes(); XacmlResourceAttributes resourceAttributes = GetResourceAttributeValues(resourceContextAttributes); await EnrichSubjectAttributes(request, resourceAttributes.ResourcePartyValue); }
private void AddRequestAttributes(XacmlContextRequest decisionRequest, XacmlContextResult result) { foreach (XacmlContextAttributes attribute in decisionRequest.Attributes) { bool hasResponseAttributes = false; XacmlContextAttributes responseAttribute = new XacmlContextAttributes(attribute.Category) { Content = attribute.Content, Id = attribute.Id }; foreach (XacmlAttribute atr in attribute.Attributes) { if (atr.IncludeInResult) { hasResponseAttributes = true; responseAttribute.Attributes.Add(atr); } } if (hasResponseAttributes) { result.Attributes.Add(responseAttribute); } } }
private void AddIfValueDoesNotExist(XacmlContextAttributes resourceAttributes, string attributeId, string attributeValue, string newAttributeValue) { if (string.IsNullOrEmpty(attributeValue)) { resourceAttributes.Attributes.Add(GetAttribute(attributeId, newAttributeValue)); } }
private List <XacmlContextAttributes> GetXacmlContextAttributesWithOrgAndApp(bool existingApp = true) { List <XacmlContextAttributes> xacmlContexts = new List <XacmlContextAttributes>(); XacmlContextAttributes xacmlContext = new XacmlContextAttributes(new Uri(XacmlConstants.MatchAttributeCategory.Resource)); XacmlAttribute xacmlAttributeOrg = new XacmlAttribute(new Uri("urn:altinn:org"), true); xacmlAttributeOrg.AttributeValues.Add(new XacmlAttributeValue(new Uri("urn:altinn:org"), ORG)); xacmlContext.Attributes.Add(xacmlAttributeOrg); xacmlContexts.Add(xacmlContext); XacmlContextAttributes xacmlContext2 = new XacmlContextAttributes(new Uri(XacmlConstants.MatchAttributeCategory.Resource)); XacmlAttribute xacmlAttributeApp = new XacmlAttribute(new Uri("urn:altinn:app"), true); if (existingApp) { xacmlAttributeApp.AttributeValues.Add(new XacmlAttributeValue(new Uri("urn:altinn:app"), APP)); } else { xacmlAttributeApp.AttributeValues.Add(new XacmlAttributeValue(new Uri("urn:altinn:app"), "dummy-app")); } xacmlContext2.Attributes.Add(xacmlAttributeApp); xacmlContexts.Add(xacmlContext2); return(xacmlContexts); }
/// <summary> /// Updates needed subject information for the Context Request for a specific delegation /// </summary> /// <param name="request">The original Xacml Context Request</param> /// <param name="subjects">The list of PartyIds to be added as subject attributes</param> public void Enrich(XacmlContextRequest request, List <int> subjects) { if (subjects?.Count == 0) { return; } XacmlContextAttributes subjectContextAttributes = request.GetSubjectAttributes(); subjectContextAttributes.Attributes.Add(GetPartyIdsAttribute(subjects)); }
private static void AssertEqual(XacmlContextAttributes expected, XacmlContextAttributes actual) { Assert.Equal(expected.Category.OriginalString, actual.Category.OriginalString); List <XacmlAttribute> expectedList = expected.Attributes.ToList(); List <XacmlAttribute> actualList = actual.Attributes.ToList(); for (int i = 0; i < expected.Attributes.Count; i++) { AssertEqual(expectedList[i], actualList[i]); } }
private async Task EnrichResourceAttributes(XacmlContextRequest request) { XacmlContextAttributes resourceContextAttributes = request.GetResourceAttributes(); XacmlResourceAttributes resourceAttributes = GetResourceAttributeValues(resourceContextAttributes); bool resourceAttributeComplete = false; if (!string.IsNullOrEmpty(resourceAttributes.OrgValue) && !string.IsNullOrEmpty(resourceAttributes.AppValue) && !string.IsNullOrEmpty(resourceAttributes.InstanceValue) && !string.IsNullOrEmpty(resourceAttributes.ResourcePartyValue) && !string.IsNullOrEmpty(resourceAttributes.TaskValue)) { // The resource attributes are complete resourceAttributeComplete = true; } else if (!string.IsNullOrEmpty(resourceAttributes.OrgValue) && !string.IsNullOrEmpty(resourceAttributes.AppValue) && string.IsNullOrEmpty(resourceAttributes.InstanceValue) && !string.IsNullOrEmpty(resourceAttributes.ResourcePartyValue) && string.IsNullOrEmpty(resourceAttributes.TaskValue)) { // The resource attributes are complete resourceAttributeComplete = true; } if (!resourceAttributeComplete) { Instance instanceData = await _instanceService.GetInstance(resourceAttributes.AppValue, resourceAttributes.OrgValue, Convert.ToInt32(resourceAttributes.InstanceValue.Split('/')[0]), new Guid(resourceAttributes.InstanceValue.Split('/')[1])); if (instanceData != null) { AddIfValueDoesNotExist(resourceContextAttributes, XacmlRequestAttribute.OrgAttribute, resourceAttributes.OrgValue, instanceData.Org); string app = instanceData.AppId.Split("/")[1]; AddIfValueDoesNotExist(resourceContextAttributes, XacmlRequestAttribute.AppAttribute, resourceAttributes.AppValue, app); if (instanceData.Process?.CurrentTask != null) { AddIfValueDoesNotExist(resourceContextAttributes, XacmlRequestAttribute.TaskAttribute, resourceAttributes.TaskValue, instanceData.Process.CurrentTask.ElementId); } else if (instanceData.Process?.EndEvent != null) { AddIfValueDoesNotExist(resourceContextAttributes, XacmlRequestAttribute.EndEventAttribute, null, instanceData.Process.EndEvent); } AddIfValueDoesNotExist(resourceContextAttributes, XacmlRequestAttribute.PartyAttribute, resourceAttributes.ResourcePartyValue, instanceData.InstanceOwner.PartyId); resourceAttributes.ResourcePartyValue = instanceData.InstanceOwner.PartyId; } } await EnrichSubjectAttributes(request, resourceAttributes.ResourcePartyValue); }
private async Task EnrichResourceAttributes(XacmlContextRequest request) { XacmlContextAttributes resourceContextAttributes = request.GetResourceAttributes(); XacmlResourceAttributes resourceAttributes = GetResourceAttributeValues(resourceContextAttributes); bool resourceAttributeComplete = false; if (!string.IsNullOrEmpty(resourceAttributes.OrgValue) && !string.IsNullOrEmpty(resourceAttributes.AppValue) && !string.IsNullOrEmpty(resourceAttributes.InstanceValue) && !string.IsNullOrEmpty(resourceAttributes.ResourcePartyValue) && !string.IsNullOrEmpty(resourceAttributes.TaskValue)) { // The resource attributes are complete resourceAttributeComplete = true; } else if (!string.IsNullOrEmpty(resourceAttributes.OrgValue) && !string.IsNullOrEmpty(resourceAttributes.AppValue) && string.IsNullOrEmpty(resourceAttributes.InstanceValue) && !string.IsNullOrEmpty(resourceAttributes.ResourcePartyValue) && string.IsNullOrEmpty(resourceAttributes.TaskValue)) { // The resource attributes are complete resourceAttributeComplete = true; } if (!resourceAttributeComplete && !string.IsNullOrEmpty(resourceAttributes.InstanceValue)) { Instance instanceData = await _policyInformationRepository.GetInstance(resourceAttributes.InstanceValue); if (instanceData != null) { AddIfValueDoesNotExist(resourceContextAttributes, XacmlRequestAttribute.OrgAttribute, resourceAttributes.OrgValue, instanceData.Org); string app = instanceData.AppId.Split("/")[1]; AddIfValueDoesNotExist(resourceContextAttributes, XacmlRequestAttribute.AppAttribute, resourceAttributes.AppValue, app); if (instanceData.Process?.CurrentTask != null) { AddIfValueDoesNotExist(resourceContextAttributes, XacmlRequestAttribute.TaskAttribute, resourceAttributes.TaskValue, instanceData.Process.CurrentTask.ElementId); } AddIfValueDoesNotExist(resourceContextAttributes, XacmlRequestAttribute.PartyAttribute, resourceAttributes.ResourcePartyValue, instanceData.InstanceOwner.PartyId); resourceAttributes.ResourcePartyValue = instanceData.InstanceOwner.PartyId; } } await EnrichSubjectAttributes(request, resourceAttributes.ResourcePartyValue); }
private static void WriteContextAttributes(XmlWriter writer, XacmlContextAttributes xacmlContextAttributes) { Guard.ArgumentNotNull(writer, nameof(writer)); Guard.ArgumentNotNull(xacmlContextAttributes, nameof(xacmlContextAttributes)); writer.WriteStartElement(XacmlConstants.Prefixes.Xacml, XacmlConstants.ElementNames.Attributes, Xacml30Constants.NameSpaces.Policy); writer.WriteAttributeString(XacmlConstants.AttributeNames.Category, xacmlContextAttributes.Category.OriginalString); if (xacmlContextAttributes.Id != null) { writer.WriteAttributeString(XacmlConstants.Prefixes.Xml, XacmlConstants.AttributeNames.Id, XmlConstants.Namespaces.XmlNamespace, xacmlContextAttributes.Id.ToString()); } if (!string.IsNullOrEmpty(xacmlContextAttributes.Content)) { writer.WriteElementString(XacmlConstants.Prefixes.Xacml, XacmlConstants.ElementNames.Content, Xacml30Constants.NameSpaces.Policy, xacmlContextAttributes.Content); } foreach (var attr in xacmlContextAttributes.Attributes) { writer.WriteStartElement(XacmlConstants.Prefixes.Xacml, XacmlConstants.ElementNames.Attribute, Xacml30Constants.NameSpaces.Policy); writer.WriteAttributeString(XacmlConstants.AttributeNames.AttributeId, attr.AttributeId.OriginalString); writer.WriteAttributeString(XacmlConstants.AttributeNames.IncludeInResult, attr.IncludeInResult.ToString().ToLower()); if (!string.IsNullOrEmpty(attr.Issuer)) { writer.WriteAttributeString(XacmlConstants.AttributeNames.Issuer, attr.Issuer); } foreach (XacmlAttributeValue attrVal in attr.AttributeValues) { WriteAttributeValue(writer, attrVal); } writer.WriteEndElement(); } writer.WriteEndElement(); }
private static void ConvertCategoryAttributes(List <XacmlJsonCategory> categoryList, string categoryId, ICollection <XacmlContextAttributes> contextAttributes) { if (categoryList == null) { return; } foreach (XacmlJsonCategory category in categoryList) { if (!string.IsNullOrEmpty(category.CategoryId)) { categoryId = category.CategoryId; } XacmlContextAttributes xacmlContextAttributes = new XacmlContextAttributes(new Uri(categoryId)); ICollection <XacmlAttributeValue> attributeValues = new Collection <XacmlAttributeValue>(); Dictionary <string, XacmlAttribute> attributeDictionary = new Dictionary <string, XacmlAttribute>(); foreach (XacmlJsonAttribute jsonAttribute in category.Attribute) { if (!attributeDictionary.ContainsKey(jsonAttribute.AttributeId)) { attributeDictionary.Add(jsonAttribute.AttributeId, new XacmlAttribute(new Uri(jsonAttribute.AttributeId), jsonAttribute.IncludeInResult)); } XacmlAttributeValue xacmlAttributeValue = new XacmlAttributeValue(new Uri(ConvertDataType(jsonAttribute)), jsonAttribute.Value); attributeDictionary[jsonAttribute.AttributeId].AttributeValues.Add(xacmlAttributeValue); } foreach (KeyValuePair <string, XacmlAttribute> kvp in attributeDictionary) { xacmlContextAttributes.Attributes.Add(kvp.Value); } contextAttributes.Add(xacmlContextAttributes); } }
private List <XacmlContextAttributes> GetXacmlContextAttributesWithOrgAndApp() { List <XacmlContextAttributes> xacmlContexts = new List <XacmlContextAttributes>(); XacmlContextAttributes xacmlContext = new XacmlContextAttributes(new Uri(XacmlConstants.MatchAttributeCategory.Resource)); XacmlAttribute xacmlAttributeOrg = new XacmlAttribute(new Uri("urn:altinn:org"), true); xacmlAttributeOrg.AttributeValues.Add(new XacmlAttributeValue(new Uri("urn:altinn:org"), "org")); xacmlContext.Attributes.Add(xacmlAttributeOrg); xacmlContexts.Add(xacmlContext); XacmlContextAttributes xacmlContext2 = new XacmlContextAttributes(new Uri(XacmlConstants.MatchAttributeCategory.Resource)); XacmlAttribute xacmlAttributeApp = new XacmlAttribute(new Uri("urn:altinn:app"), true); xacmlAttributeApp.AttributeValues.Add(new XacmlAttributeValue(new Uri("urn:altinn:app"), "app")); xacmlContext2.Attributes.Add(xacmlAttributeApp); xacmlContexts.Add(xacmlContext2); return(xacmlContexts); }
private async Task EnrichSubjectAttributes(XacmlContextRequest request, string resourceParty) { XacmlContextAttributes subjectContextAttributes = request.GetSubjectAttributes(); int subjectUserId = 0; int resourcePartyId = Convert.ToInt32(resourceParty); foreach (XacmlAttribute xacmlAttribute in subjectContextAttributes.Attributes) { if (xacmlAttribute.AttributeId.OriginalString.Equals(_userAttributeId)) { subjectUserId = Convert.ToInt32(xacmlAttribute.AttributeValues.First().Value); } } if (subjectUserId == 0) { return; } List <Role> roleList = await _rolesWrapper.GetDecisionPointRolesForUser(subjectUserId, resourcePartyId) ?? new List <Role>(); subjectContextAttributes.Attributes.Add(GetRoleAttribute(roleList)); }
/// <summary> /// Gets a XacmlResourceAttributes model from the XacmlContextRequest /// </summary> /// <param name="request">The Xacml Context Request</param> /// <returns>XacmlResourceAttributes model</returns> public XacmlResourceAttributes GetResourceAttributes(XacmlContextRequest request) { XacmlContextAttributes resourceContextAttributes = request.GetResourceAttributes(); return(GetResourceAttributeValues(resourceContextAttributes)); }
private async Task EnrichResourceAttributes(XacmlContextRequest request) { XacmlContextAttributes resourceContextAttributes = request.GetResourceAttributes(); await EnrichSubjectAttributes(request, "hap"); }
private async Task EnrichResourceAttributes(XacmlContextRequest request) { string orgAttributeValue = string.Empty; string appAttributeValue = string.Empty; string instanceAttributeValue = string.Empty; string resourcePartyAttributeValue = string.Empty; string taskAttributeValue = string.Empty; string endEventAttribute = string.Empty; XacmlContextAttributes resourceContextAttributes = request.GetResourceAttributes(); foreach (XacmlAttribute attribute in resourceContextAttributes.Attributes) { if (attribute.AttributeId.OriginalString.Equals(OrgAttributeId)) { orgAttributeValue = attribute.AttributeValues.First().Value; } if (attribute.AttributeId.OriginalString.Equals(AppAttributeId)) { appAttributeValue = attribute.AttributeValues.First().Value; } if (attribute.AttributeId.OriginalString.Equals(InstanceAttributeId)) { instanceAttributeValue = attribute.AttributeValues.First().Value; } if (attribute.AttributeId.OriginalString.Equals(TaskAttributeId)) { taskAttributeValue = attribute.AttributeValues.First().Value; } if (attribute.AttributeId.OriginalString.Equals(PartyAttributeId)) { resourcePartyAttributeValue = attribute.AttributeValues.First().Value; } if (attribute.AttributeId.OriginalString.Equals(endEventAttribute)) { endEventAttribute = attribute.AttributeValues.First().Value; } } bool resourceAttributeComplete = false; if (!string.IsNullOrEmpty(orgAttributeValue) && !string.IsNullOrEmpty(appAttributeValue) && !string.IsNullOrEmpty(instanceAttributeValue) && !string.IsNullOrEmpty(resourcePartyAttributeValue) && (!string.IsNullOrEmpty(taskAttributeValue) || !string.IsNullOrEmpty(endEventAttribute))) { // The resource attributes are complete resourceAttributeComplete = true; } else if (!string.IsNullOrEmpty(orgAttributeValue) && !string.IsNullOrEmpty(appAttributeValue) && string.IsNullOrEmpty(instanceAttributeValue) && !string.IsNullOrEmpty(resourcePartyAttributeValue) && (!string.IsNullOrEmpty(taskAttributeValue) || !string.IsNullOrEmpty(endEventAttribute))) { // The resource attributes are complete resourceAttributeComplete = true; } if (!resourceAttributeComplete) { Instance instanceData = await _instanceService.GetInstance(appAttributeValue, orgAttributeValue, Convert.ToInt32(instanceAttributeValue.Split('/')[0]), new Guid(instanceAttributeValue.Split('/')[1])); if (string.IsNullOrEmpty(orgAttributeValue) && instanceData != null) { resourceContextAttributes.Attributes.Add(GetOrgAttribute(instanceData)); } if (string.IsNullOrEmpty(appAttributeValue) && instanceData != null) { resourceContextAttributes.Attributes.Add(GetAppAttribute(instanceData)); } if (string.IsNullOrEmpty(taskAttributeValue) && instanceData?.Process?.CurrentTask != null) { resourceContextAttributes.Attributes.Add(GetProcessElementAttribute(instanceData)); } else if (string.IsNullOrEmpty(endEventAttribute) && instanceData?.Process?.EndEvent != null) { resourceContextAttributes.Attributes.Add(GetEndEventAttribute(instanceData)); } if (string.IsNullOrEmpty(resourcePartyAttributeValue) && instanceData != null) { resourceContextAttributes.Attributes.Add(GetPartyAttribute(instanceData)); } if (instanceData != null) { resourcePartyAttributeValue = instanceData.InstanceOwner.PartyId; } } await EnrichSubjectAttributes(request, resourcePartyAttributeValue); }
private async Task EnrichResourceAttributes(XacmlContextRequest request) { string orgAttributeValue = string.Empty; string appAttributeValue = string.Empty; string instanceAttributeValue = string.Empty; string resourcePartyAttributeValue = string.Empty; string taskAttributeValue = string.Empty; string appresourceAttributeValue = string.Empty; XacmlContextAttributes resourceContextAttributes = request.GetResourceAttributes(); foreach (XacmlAttribute attribute in resourceContextAttributes.Attributes) { if (attribute.AttributeId.OriginalString.Equals(_orgAttributeId)) { orgAttributeValue = attribute.AttributeValues.First().Value; } if (attribute.AttributeId.OriginalString.Equals(_appAttributeId)) { appAttributeValue = attribute.AttributeValues.First().Value; } if (attribute.AttributeId.OriginalString.Equals(_instanceAttributeId)) { instanceAttributeValue = attribute.AttributeValues.First().Value; } if (attribute.AttributeId.OriginalString.Equals(_taskAttributeId)) { taskAttributeValue = attribute.AttributeValues.First().Value; } if (attribute.AttributeId.OriginalString.Equals(_partyAttributeId)) { resourcePartyAttributeValue = attribute.AttributeValues.First().Value; } if (attribute.AttributeId.OriginalString.Equals(_appresourceAttributeId)) { appresourceAttributeValue = attribute.AttributeValues.First().Value; } } bool resourceAttributeComplete = false; if (!string.IsNullOrEmpty(orgAttributeValue) && !string.IsNullOrEmpty(appAttributeValue) && !string.IsNullOrEmpty(instanceAttributeValue) && !string.IsNullOrEmpty(resourcePartyAttributeValue) && !string.IsNullOrEmpty(taskAttributeValue)) { // The resource attributes are complete resourceAttributeComplete = true; } else if (!string.IsNullOrEmpty(orgAttributeValue) && !string.IsNullOrEmpty(appAttributeValue) && string.IsNullOrEmpty(instanceAttributeValue) && !string.IsNullOrEmpty(resourcePartyAttributeValue) && string.IsNullOrEmpty(taskAttributeValue)) { // The resource attributes are complete resourceAttributeComplete = true; } else if (!string.IsNullOrEmpty(orgAttributeValue) && !string.IsNullOrEmpty(appAttributeValue) && !string.IsNullOrEmpty(instanceAttributeValue) && !string.IsNullOrEmpty(resourcePartyAttributeValue) && !string.IsNullOrEmpty(appresourceAttributeValue) && appresourceAttributeValue.Equals("events")) { // Events scenario The resource attributes are complete resourceAttributeComplete = true; } if (!resourceAttributeComplete) { Instance instanceData = GetTestInstance(instanceAttributeValue); if (string.IsNullOrEmpty(orgAttributeValue)) { resourceContextAttributes.Attributes.Add(GetOrgAttribute(instanceData)); } if (string.IsNullOrEmpty(appAttributeValue)) { resourceContextAttributes.Attributes.Add(GetAppAttribute(instanceData)); } if (string.IsNullOrEmpty(taskAttributeValue)) { resourceContextAttributes.Attributes.Add(GetProcessElementAttribute(instanceData)); } if (string.IsNullOrEmpty(resourcePartyAttributeValue)) { resourceContextAttributes.Attributes.Add(GetPartyAttribute(instanceData)); } resourcePartyAttributeValue = instanceData.InstanceOwner.PartyId; } await EnrichSubjectAttributes(request, resourcePartyAttributeValue); }