blob: 1329ce2edaa43ad7e09462b2196f259af69f3ea2 (
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
|
//-----------------------------------------------------------------------
// <copyright file="OAuth2AuthorizationServerElement.cs" company="Outercurve Foundation">
// Copyright (c) Outercurve Foundation. All rights reserved.
// </copyright>
//-----------------------------------------------------------------------
namespace DotNetOpenAuth.Configuration {
using System;
using System.Configuration;
using DotNetOpenAuth.Messaging.Bindings;
using DotNetOpenAuth.OAuth2.ChannelElements;
/// <summary>
/// Represents the <oauth2/authorizationServer> element in the host's .config file.
/// </summary>
internal class OAuth2AuthorizationServerElement : ConfigurationElement {
/// <summary>
/// The name of the <clientAuthenticationModules> sub-element.
/// </summary>
private const string ClientAuthenticationModulesElementName = "clientAuthenticationModules";
/// <summary>
/// The built-in set of identifier discovery services.
/// </summary>
private static readonly TypeConfigurationCollection<IClientAuthenticationModule> defaultClientAuthenticationModules =
new TypeConfigurationCollection<IClientAuthenticationModule>();
/// <summary>
/// Initializes a new instance of the <see cref="OAuth2AuthorizationServerElement"/> class.
/// </summary>
internal OAuth2AuthorizationServerElement() {
}
/// <summary>
/// Gets or sets the services to use for discovering service endpoints for identifiers.
/// </summary>
/// <remarks>
/// If no discovery services are defined in the (web) application's .config file,
/// the default set of discovery services built into the library are used.
/// </remarks>
[ConfigurationProperty(ClientAuthenticationModulesElementName, IsDefaultCollection = false)]
[ConfigurationCollection(typeof(TypeConfigurationCollection<IClientAuthenticationModule>))]
internal TypeConfigurationCollection<IClientAuthenticationModule> ClientAuthenticationModules {
get {
var configResult = (TypeConfigurationCollection<IClientAuthenticationModule>)this[ClientAuthenticationModulesElementName];
return configResult != null && configResult.Count > 0 ? configResult : defaultClientAuthenticationModules;
}
set {
this[ClientAuthenticationModulesElementName] = value;
}
}
}
}
|