public void Saml2RequestedAuthnContext_Ctor_HandlesEmpty() { var config = new RequestedAuthnContextElement(); var subject = new Saml2RequestedAuthnContext(config); subject.ClassRef.Should().BeNull(); }
public void Saml2RequestedAuthnContext_Ctor_HandlesFullUri() { var config = new RequestedAuthnContextElement(); config.AllowChange = true; var classRef = "http://id.sambi.se/loa2"; config.AuthnContextClassRef = classRef; var subject = new Saml2RequestedAuthnContext(config); subject.ClassRef.Should().Be(classRef); }
/// <summary> /// Ctor /// </summary> /// <param name="requestedAuthnContextElement">Config element to load.</param> public Saml2RequestedAuthnContext(RequestedAuthnContextElement requestedAuthnContextElement) { if(requestedAuthnContextElement == null) { throw new ArgumentNullException(nameof(requestedAuthnContextElement)); } if(!string.IsNullOrEmpty(requestedAuthnContextElement.AuthnContextClassRef)) { ClassRef = new Uri( !requestedAuthnContextElement.AuthnContextClassRef.Contains(":") ? "urn:oasis:names:tc:SAML:2.0:ac:classes:" + requestedAuthnContextElement.AuthnContextClassRef : requestedAuthnContextElement.AuthnContextClassRef); } Comparison = requestedAuthnContextElement.Comparison; }