private void ParameterizedAXTest(AXAttributeFormats format)
        {
            var axInjected = new FetchRequest();

            axInjected.Attributes.AddOptional(ExtensionsInteropHelper_Accessor.TransformAXFormat(WellKnownAttributes.Name.Alias, format));
            axInjected.Attributes.AddRequired(ExtensionsInteropHelper_Accessor.TransformAXFormat(WellKnownAttributes.Name.FullName, format));
            this.extensions.Add(axInjected);
            var sreg = ExtensionsInteropHelper.UnifyExtensionsAsSreg(this.request);

            Assert.AreSame(sreg, this.request.GetExtension <ClaimsRequest>());
            Assert.AreEqual(DemandLevel.Request, sreg.Nickname);
            Assert.AreEqual(DemandLevel.Require, sreg.FullName);
            Assert.AreEqual(DemandLevel.NoRequest, sreg.Language);

            var sregResponse = new ClaimsResponse {
                Nickname = "andy",
            };

            this.request.AddResponseExtension(sregResponse);
            ExtensionsInteropHelper.ConvertSregToMatchRequest(this.request);
            var extensions = this.GetResponseExtensions();
            var axResponse = extensions.OfType <FetchResponse>().Single();

            Assert.AreEqual("andy", axResponse.GetAttributeValue(ExtensionsInteropHelper_Accessor.TransformAXFormat(WellKnownAttributes.Name.Alias, format)));
        }
Beispiel #2
0
        public void UnifyExtensionsasSregFromSchemaOpenIdNet()
        {
            var axInjected = new FetchResponse();

            axInjected.Attributes.Add(ExtensionsInteropHelper_Accessor.TransformAXFormat(WellKnownAttributes.Name.Alias, AXAttributeFormats.SchemaOpenIdNet), "nate");
            this.extensions.Add(axInjected);
            var sreg = ExtensionsInteropHelper.UnifyExtensionsAsSreg(this.response, true);

            Assert.AreEqual("nate", sreg.Nickname);
        }
        public void SpreadSregToAxMultipleSchemas()
        {
            this.authReq.AddExtension(this.sreg);
            ExtensionsInteropHelper.SpreadSregToAX(this.authReq, AXAttributeFormats.AXSchemaOrg | AXAttributeFormats.SchemaOpenIdNet);
            var ax = this.authReq.AppliedExtensions.OfType <FetchRequest>().Single();

            Assert.IsTrue(ax.Attributes.Contains(WellKnownAttributes.Name.Alias));
            Assert.IsTrue(ax.Attributes.Contains(ExtensionsInteropHelper_Accessor.TransformAXFormat(WellKnownAttributes.Name.Alias, AXAttributeFormats.SchemaOpenIdNet)));
            Assert.IsFalse(ax.Attributes.Contains(ExtensionsInteropHelper_Accessor.TransformAXFormat(WellKnownAttributes.Name.Alias, AXAttributeFormats.OpenIdNetSchema)));
        }
        public void SpreadSregToAxTargetedAtOPFormat()
        {
            this.authReq.AddExtension(this.sreg);
            this.InjectAdvertisedTypeUri(WellKnownAttributes.Name.FullName);
            ExtensionsInteropHelper.SpreadSregToAX(this.authReq, AXAttributeFormats.OpenIdNetSchema);
            var ax = this.authReq.AppliedExtensions.OfType <FetchRequest>().Single();

            Assert.IsFalse(ax.Attributes.Contains(ExtensionsInteropHelper_Accessor.TransformAXFormat(WellKnownAttributes.Contact.Email, AXAttributeFormats.OpenIdNetSchema)));
            Assert.IsTrue(ax.Attributes.Contains(WellKnownAttributes.Contact.Email));
        }
 public void TransformAXFormatTest()
 {
     Assert.AreEqual(WellKnownAttributes.Name.Alias, ExtensionsInteropHelper_Accessor.TransformAXFormat(WellKnownAttributes.Name.Alias, AXAttributeFormats.AXSchemaOrg));
     Assert.AreEqual("http://schema.openid.net/namePerson/friendly", ExtensionsInteropHelper_Accessor.TransformAXFormat(WellKnownAttributes.Name.Alias, AXAttributeFormats.SchemaOpenIdNet));
     Assert.AreEqual("http://openid.net/schema/namePerson/friendly", ExtensionsInteropHelper_Accessor.TransformAXFormat(WellKnownAttributes.Name.Alias, AXAttributeFormats.OpenIdNetSchema));
 }