blob: a6c84b893380abc26b76903a277dbdf56fc13d98 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
|
namespace MvcRelyingParty {
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using DotNetOpenAuth.Messaging;
using DotNetOpenAuth.OpenId;
using DotNetOpenAuth.OpenId.RelyingParty;
public interface IOpenIdRelyingParty {
Channel Channel { get; }
IAuthenticationRequest CreateRequest(Identifier userSuppliedIdentifier, Realm realm, Uri returnTo);
IEnumerable<IAuthenticationRequest> CreateRequests(Identifier userSuppliedIdentifier, Realm realm, Uri returnTo);
IAuthenticationResponse GetResponse();
IAuthenticationResponse GetResponse(HttpRequestInfo request);
}
/// <summary>
/// A wrapper around the standard <see cref="OpenIdRelyingParty"/> class.
/// </summary>
public class OpenIdRelyingPartyService : IOpenIdRelyingParty {
/// <summary>
/// The OpenID relying party to use for logging users in.
/// </summary>
/// <remarks>
/// This is static because it is thread-safe and is more expensive
/// to create than we want to run through for every single page request.
/// </remarks>
private static OpenIdRelyingParty relyingParty = new OpenIdRelyingParty();
/// <summary>
/// Initializes a new instance of the <see cref="OpenIdRelyingPartyService"/> class.
/// </summary>
public OpenIdRelyingPartyService() {
}
#region IOpenIdRelyingParty Members
public Channel Channel {
get { return relyingParty.Channel; }
}
public IAuthenticationRequest CreateRequest(Identifier userSuppliedIdentifier, Realm realm, Uri returnTo) {
return relyingParty.CreateRequest(userSuppliedIdentifier, realm, returnTo);
}
public IEnumerable<IAuthenticationRequest> CreateRequests(Identifier userSuppliedIdentifier, Realm realm, Uri returnTo) {
return relyingParty.CreateRequests(userSuppliedIdentifier, realm, returnTo);
}
public IAuthenticationResponse GetResponse() {
return relyingParty.GetResponse();
}
public IAuthenticationResponse GetResponse(HttpRequestInfo request) {
return relyingParty.GetResponse(request);
}
#endregion
}
}
|