private static GW.Security MakeSecurity(GW.AssertionType assertion) { return(new GW.Security { id = Guid.NewGuid().ToString("D"), Timestamp = new GW.Timestamp { Created = DateTimeEx.UtcNowRound - TimeSpan.FromMinutes(5) }, Assertion = assertion }); }
private static GW.AssertionType MakeAssertionForSTS() { var vnow = DateTimeEx.UtcNowRound - TimeSpan.FromMinutes(5); var later = (vnow + TimeSpan.FromHours(8)).ToString("u").Replace(' ', 'T'); var ass = new GW.AssertionType { IssueInstant = vnow, id = "IDCard", Version = 2.0m, Issuer = "WinPLC", Conditions = new GW.Conditions { NotBefore = vnow, NotOnOrAfter = vnow + TimeSpan.FromHours(8) }, Subject = new GW.Subject { NameID = new GW.NameIDType { Format = GW.SubjectIdentifierType.medcomcprnumber, Value = "2203333571" }, SubjectConfirmation = new GW.SubjectConfirmation { ConfirmationMethod = GW.ConfirmationMethod.urnoasisnamestcSAML20cmholderofkey, SubjectConfirmationData = new GW.SubjectConfirmationData { Item = new GW.KeyInfo { Item = "OCESSignature" } } } }, AttributeStatement = new[] { new GW.AttributeStatement { id = GW.AttributeStatementID.IDCardData, Attribute = new[] { new GW.Attribute { Name = GW.AttributeName.sosiIDCardID, AttributeValue = Guid.NewGuid().ToString("D") }, new GW.Attribute { Name = GW.AttributeName.sosiIDCardVersion, AttributeValue = "1.0.1" }, new GW.Attribute { Name = GW.AttributeName.sosiIDCardType, AttributeValue = "user" }, new GW.Attribute { Name = GW.AttributeName.sosiAuthenticationLevel, AttributeValue = "4" } } }, new GW.AttributeStatement { id = GW.AttributeStatementID.UserLog, Attribute = new[] { new GW.Attribute { Name = GW.AttributeName.medcomUserCivilRegistrationNumber, AttributeValue = "1802602810" }, new GW.Attribute { Name = GW.AttributeName.medcomUserGivenName, AttributeValue = "Stine" }, new GW.Attribute { Name = GW.AttributeName.medcomUserSurName, AttributeValue = "Svendsen" }, new GW.Attribute { Name = GW.AttributeName.medcomUserEmailAddress, AttributeValue = "*****@*****.**" }, new GW.Attribute { Name = GW.AttributeName.medcomUserRole, AttributeValue = "læge" }, new GW.Attribute { Name = GW.AttributeName.medcomUserAuthorizationCode, AttributeValue = "ZXCVB" } } }, new GW.AttributeStatement { id = GW.AttributeStatementID.SystemLog, Attribute = new[] { new GW.Attribute { Name = GW.AttributeName.medcomITSystemName, AttributeValue = "Sygdom.dk" }, new GW.Attribute { Name = GW.AttributeName.medcomCareProviderID, AttributeValue = "30808460", NameFormat = GW.SubjectIdentifierType.medcomcvrnumber, NameFormatSpecified = true }, new GW.Attribute { Name = GW.AttributeName.medcomCareProviderName, AttributeValue = "Statens Serum Institut" } } } } }; return(ass); }