/// <summary> /// Sets the profile request properties according to a list of /// field names that might have been passed in the OpenId query dictionary. /// </summary> /// <param name="fieldNames"> /// The list of field names that should receive a given /// <paramref name="requestLevel"/>. These field names should match /// the OpenId specification for field names, omitting the 'openid.sreg' prefix. /// </param> /// <param name="requestLevel">The none/request/require state of the listed fields.</param> internal void SetProfileRequestFromList(IEnumerable <string> fieldNames, DemandLevel requestLevel) { foreach (string field in fieldNames) { switch (field) { case "": // this occurs for empty lists break; case Constants.nickname: this.Nickname = requestLevel; break; case Constants.email: this.Email = requestLevel; break; case Constants.fullname: this.FullName = requestLevel; break; case Constants.dob: this.BirthDate = requestLevel; break; case Constants.gender: this.Gender = requestLevel; break; case Constants.postcode: this.PostalCode = requestLevel; break; case Constants.country: this.Country = requestLevel; break; case Constants.language: this.Language = requestLevel; break; case Constants.timezone: this.TimeZone = requestLevel; break; default: Logger.OpenId.WarnFormat("ClaimsRequest.SetProfileRequestFromList: Unrecognized field name '{0}'.", field); break; } } }
private void SetProfileRequestFromList(ICollection <string> fieldNames, DemandLevel requestLevel) { foreach (string field in fieldNames) { switch (field) { case Constants.nickname: this.Nickname = requestLevel; break; case Constants.email: this.Email = requestLevel; break; case Constants.fullname: this.FullName = requestLevel; break; case Constants.dob: this.BirthDate = requestLevel; break; case Constants.gender: this.Gender = requestLevel; break; case Constants.postcode: this.PostalCode = requestLevel; break; case Constants.country: this.Country = requestLevel; break; case Constants.language: this.Language = requestLevel; break; case Constants.timezone: this.TimeZone = requestLevel; break; default: Logger.WarnFormat("OpenIdProfileRequest.SetProfileRequestFromList: Unrecognized field name '{0}'.", field); break; } } }
private string[] AssembleProfileFields(DemandLevel level) { List <string> fields = new List <string>(10); if (this.Nickname == level) { fields.Add(Constants.nickname); } if (this.Email == level) { fields.Add(Constants.email); } if (this.FullName == level) { fields.Add(Constants.fullname); } if (this.BirthDate == level) { fields.Add(Constants.dob); } if (this.Gender == level) { fields.Add(Constants.gender); } if (this.PostalCode == level) { fields.Add(Constants.postcode); } if (this.Country == level) { fields.Add(Constants.country); } if (this.Language == level) { fields.Add(Constants.language); } if (this.TimeZone == level) { fields.Add(Constants.timezone); } return(fields.ToArray()); }
/// <summary> /// Sets the profile request properties according to a list of /// field names that might have been passed in the OpenId query dictionary. /// </summary> /// <param name="fieldNames"> /// The list of field names that should receive a given /// <paramref name="requestLevel"/>. These field names should match /// the OpenId specification for field names, omitting the 'openid.sreg' prefix. /// </param> /// <param name="requestLevel">The none/request/require state of the listed fields.</param> internal void SetProfileRequestFromList(ICollection<string> fieldNames, DemandLevel requestLevel) { foreach (string field in fieldNames) { switch (field) { case Constants.nickname: Nickname = requestLevel; break; case Constants.email: Email = requestLevel; break; case Constants.fullname: FullName = requestLevel; break; case Constants.dob: BirthDate = requestLevel; break; case Constants.gender: Gender = requestLevel; break; case Constants.postcode: PostalCode = requestLevel; break; case Constants.country: Country = requestLevel; break; case Constants.language: Language = requestLevel; break; case Constants.timezone: TimeZone = requestLevel; break; default: Logger.WarnFormat("OpenIdProfileRequest.SetProfileRequestFromList: Unrecognized field name '{0}'.", field); break; } } }
/// <summary> /// Adds an attribute fetch request if it is not already present in the AX request. /// </summary> /// <param name="ax">The AX request to add the attribute request to.</param> /// <param name="format">The format of the attribute's Type URI to use.</param> /// <param name="axSchemaOrgFormatAttribute">The attribute in axschema.org format.</param> /// <param name="demandLevel">The demand level.</param> private static void FetchAttribute(FetchRequest ax, AXAttributeFormats format, string axSchemaOrgFormatAttribute, DemandLevel demandLevel) { Contract.Requires<ArgumentNullException>(ax != null); Contract.Requires<ArgumentException>(!String.IsNullOrEmpty(axSchemaOrgFormatAttribute)); string typeUri = TransformAXFormat(axSchemaOrgFormatAttribute, format); if (!ax.Attributes.Contains(typeUri)) { switch (demandLevel) { case DemandLevel.Request: ax.Attributes.AddOptional(typeUri); break; case DemandLevel.Require: ax.Attributes.AddRequired(typeUri); break; default: break; } } }
/// <summary> /// Adds an attribute fetch request if it is not already present in the AX request. /// </summary> /// <param name="ax">The AX request to add the attribute request to.</param> /// <param name="format">The format of the attribute's Type URI to use.</param> /// <param name="axSchemaOrgFormatAttribute">The attribute in axschema.org format.</param> /// <param name="demandLevel">The demand level.</param> private static void FetchAttribute(FetchRequest ax, AXAttributeFormats format, string axSchemaOrgFormatAttribute, DemandLevel demandLevel) { Contract.Requires <ArgumentNullException>(ax != null); Contract.Requires <ArgumentException>(!String.IsNullOrEmpty(axSchemaOrgFormatAttribute)); string typeUri = TransformAXFormat(axSchemaOrgFormatAttribute, format); if (!ax.Attributes.Contains(typeUri)) { switch (demandLevel) { case DemandLevel.Request: ax.Attributes.AddOptional(typeUri); break; case DemandLevel.Require: ax.Attributes.AddRequired(typeUri); break; default: break; } } }
string[] assembleProfileFields(DemandLevel level) { List<string> fields = new List<string>(10); if (Nickname == level) fields.Add(Constants.nickname); if (Email == level) fields.Add(Constants.email); if (FullName == level) fields.Add(Constants.fullname); if (BirthDate == level) fields.Add(Constants.dob); if (Gender == level) fields.Add(Constants.gender); if (PostalCode == level) fields.Add(Constants.postcode); if (Country == level) fields.Add(Constants.country); if (Language == level) fields.Add(Constants.language); if (TimeZone == level) fields.Add(Constants.timezone); return fields.ToArray(); }
/// <summary> /// Adds an attribute fetch request if it is not already present in the AX request. /// </summary> /// <param name="ax">The AX request to add the attribute request to.</param> /// <param name="format">The format of the attribute's Type URI to use.</param> /// <param name="axSchemaOrgFormatAttribute">The attribute in axschema.org format.</param> /// <param name="demandLevel">The demand level.</param> internal static void FetchAttribute(FetchRequest ax, AXAttributeFormats format, string axSchemaOrgFormatAttribute, DemandLevel demandLevel) { Requires.NotNull(ax, "ax"); Requires.NotNullOrEmpty(axSchemaOrgFormatAttribute, "axSchemaOrgFormatAttribute"); string typeUri = TransformAXFormat(axSchemaOrgFormatAttribute, format); if (!ax.Attributes.Contains(typeUri)) { switch (demandLevel) { case DemandLevel.Request: ax.Attributes.AddOptional(typeUri); break; case DemandLevel.Require: ax.Attributes.AddRequired(typeUri); break; default: break; } } }
private string[] AssembleProfileFields(DemandLevel level) { List<string> fields = new List<string>(10); if (this.Nickname == level) { fields.Add(Constants.nickname); } if (this.Email == level) { fields.Add(Constants.email); } if (this.FullName == level) { fields.Add(Constants.fullname); } if (this.BirthDate == level) { fields.Add(Constants.dob); } if (this.Gender == level) { fields.Add(Constants.gender); } if (this.PostalCode == level) { fields.Add(Constants.postcode); } if (this.Country == level) { fields.Add(Constants.country); } if (this.Language == level) { fields.Add(Constants.language); } if (this.TimeZone == level) { fields.Add(Constants.timezone); } return fields.ToArray(); }
/// <summary> /// Sets the profile request properties according to a list of /// field names that might have been passed in the OpenId query dictionary. /// </summary> /// <param name="fieldNames"> /// The list of field names that should receive a given /// <paramref name="requestLevel"/>. These field names should match /// the OpenId specification for field names, omitting the 'openid.sreg' prefix. /// </param> /// <param name="requestLevel">The none/request/require state of the listed fields.</param> internal void SetProfileRequestFromList(IEnumerable<string> fieldNames, DemandLevel requestLevel) { foreach (string field in fieldNames) { switch (field) { case "": // this occurs for empty lists break; case Constants.nickname: this.Nickname = requestLevel; break; case Constants.email: this.Email = requestLevel; break; case Constants.fullname: this.FullName = requestLevel; break; case Constants.dob: this.BirthDate = requestLevel; break; case Constants.gender: this.Gender = requestLevel; break; case Constants.postcode: this.PostalCode = requestLevel; break; case Constants.country: this.Country = requestLevel; break; case Constants.language: this.Language = requestLevel; break; case Constants.timezone: this.TimeZone = requestLevel; break; default: Logger.OpenId.WarnFormat("ClaimsRequest.SetProfileRequestFromList: Unrecognized field name '{0}'.", field); break; } } }