public static AnonymousRequestModel MapAnonymousRequestToARModel(AnonymousRequest request)
 {
     return(new AnonymousRequestModel
     {
         Id = request.Id,
         UserId = request.User.Id,
         User = MapAspNetUserToUserModel(request.User),
         Confirmed = request.Confirmed,
         DateCreated = request.DateCreated
     });
 }
예제 #2
0
        public void IsApprovedDeterminesReturnedMessage()
        {
            var      op       = CreateProvider();
            Protocol protocol = Protocol.V20;
            var      req      = new SignedResponseRequest(protocol.Version, OPUri, AuthenticationRequestMode.Setup);

            req.ReturnTo = RPUri;
            var anonReq = new AnonymousRequest(op, req);

            Assert.IsFalse(anonReq.IsApproved.HasValue);

            anonReq.IsApproved = false;
            Assert.IsInstanceOf <NegativeAssertionResponse>(anonReq.Response);

            anonReq.IsApproved = true;
            Assert.IsInstanceOf <IndirectSignedResponse>(anonReq.Response);
            Assert.IsNotInstanceOf <PositiveAssertionResponse>(anonReq.Response);
        }
예제 #3
0
        public void Serializable()
        {
            var      op       = CreateProvider();
            Protocol protocol = Protocol.V20;
            var      req      = new SignedResponseRequest(protocol.Version, OPUri, AuthenticationRequestMode.Setup);

            req.ReturnTo = RPUri;
            var anonReq = new AnonymousRequest(op, req);

            MemoryStream ms        = new MemoryStream();
            IFormatter   formatter = new BinaryFormatter();

            formatter.Serialize(ms, anonReq);

            ms.Position = 0;
            var req2 = (AnonymousRequest)formatter.Deserialize(ms);

            Assert.That(req2, Is.Not.Null);
        }