/// <summary>
 /// Initializes a new instance of the <see cref="Saml20AuthnRequest"/> class.
 /// </summary>
 public Saml20AuthnRequest()
 {
     request = new AuthnRequest();
     request.Version = Saml20Constants.Version;
     request.ID = "id" + Guid.NewGuid().ToString("N");
     request.Issuer = new NameID();
     request.IssueInstant = DateTime.Now;
 }
        protected override void OnInit(EventArgs e)
        {
            request = Context.Application["authenticationrequest"] as AuthnRequest;

            if (request == null)
            {
                HandleRequestMissing();
                return;
            }

            User user = UserSessionsHandler.CurrentUser;

            if (user != null)
            {
                // don't issue new assertion if ForceAuthn is set
                if (request.ForceAuthn.HasValue && request.ForceAuthn.Value)
                    return;

                // User has a previous session on the IDP. Issue a new assertion.
                CreateAssertionResponse(user);
            }
        }