Example #1
0
        private static void AddAuthenticationStatement(Microsoft.IdentityModel.Tokens.Saml2.Saml2SecurityToken token)
        {
            // Chage to "urn:oasis:names:tc:SAML:2.0:ac:classes:Password" or something.
            var authenticationMethod = "urn:none";

            var authenticationContext   = new Microsoft.IdentityModel.Tokens.Saml2.Saml2AuthenticationContext(new Uri(authenticationMethod));
            var authenticationStatement = new Microsoft.IdentityModel.Tokens.Saml2.Saml2AuthenticationStatement(authenticationContext);

            token.Assertion.Statements.Add(authenticationStatement);
        }
 /// <summary>
 /// Creates an instance of Saml2AuthenticationContext.
 /// </summary>
 /// <param name="authenticationContext">The authentication context of this statement.</param>
 /// <param name="authenticationInstant">The time of the authentication.</param>
 /// <exception cref="ArgumentNullException">if <paramref name="authenticationContext"/> is null.</exception>
 public Saml2AuthenticationStatement(Saml2AuthenticationContext authenticationContext, DateTime authenticationInstant)
 {
     AuthenticationContext = authenticationContext;
     AuthenticationInstant = authenticationInstant;
 }
 /// <summary>
 /// Creates a Saml2AuthenticationStatement.
 /// </summary>
 /// <param name="authenticationContext">The authentication context of this statement.</param>
 public Saml2AuthenticationStatement(Saml2AuthenticationContext authenticationContext)
     : this(authenticationContext, DateTime.UtcNow)
 {
 }