forked from MarcoDeTiege/Saml2
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathSaml2AuthenticationOptions.cs
84 lines (75 loc) · 3.11 KB
/
Saml2AuthenticationOptions.cs
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
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
using Microsoft.Owin.Security;
using Microsoft.Owin.Security.DataProtection;
using Sustainsys.Saml2.Configuration;
namespace Sustainsys.Saml2.Owin
{
/// <summary>
/// Options for Sustainsys Saml2 Saml2 Authentication.
/// </summary>
public class Saml2AuthenticationOptions : AuthenticationOptions, IOptions
{
/// <summary>
/// Set of callbacks that can be used as extension points for various
/// events.
/// </summary>
public Saml2Notifications Notifications { get; set; }
/// <summary>
/// Constructor
/// <param name="loadConfiguration">Should the options be inited by loading app/web.config?</param>
/// </summary>
[System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Naming", "CA2204:Literals should be spelled correctly", MessageId = "SustainsysSaml2")]
[System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Globalization", "CA1303:Do not pass literals as localized parameters", MessageId = "Microsoft.Owin.Security.AuthenticationDescription.set_Caption(System.String)")]
public Saml2AuthenticationOptions(bool loadConfiguration)
: base(Constants.DefaultAuthenticationType)
{
AuthenticationMode = AuthenticationMode.Passive;
Description.Caption = Constants.DefaultCaption;
Notifications = new Saml2Notifications();
if (loadConfiguration)
{
SPOptions = new SPOptions(SustainsysSaml2Section.Current);
SustainsysSaml2Section.Current.IdentityProviders.RegisterIdentityProviders(this);
SustainsysSaml2Section.Current.Federations.RegisterFederations(this);
}
}
/// <summary>
/// The authentication type that will be used to sign in with. Typically this will be "ExternalCookie"
/// to be picked up by the external cookie authentication middleware that persists the identity in a cookie.
/// </summary>
public string SignInAsAuthenticationType { get; set; }
/// <summary>
/// Options for the service provider's behaviour; i.e. everything except
/// the idp and federation list.
/// </summary>
public SPOptions SPOptions { get; set; }
private readonly IdentityProviderDictionary identityProviders = new IdentityProviderDictionary();
/// <summary>
/// Available identity providers.
/// </summary>
public IdentityProviderDictionary IdentityProviders
{
get
{
return identityProviders;
}
}
/// <summary>
/// Passthrough property to Description.Caption.
/// </summary>
public string Caption
{
get
{
return Description.Caption;
}
set
{
Description.Caption = value;
}
}
/// <summary>
/// Gets or sets the type used to secure data handled by the middleware.
/// </summary>
internal IDataProtector DataProtector { get; set; }
}
}