1
1
// Copyright (C) 2011-2024 Xtensive LLC.
2
- // All rights reserved .
3
- // For conditions of distribution and use, see license .
2
+ // This code is distributed under MIT license terms .
3
+ // See the License.txt file in the project root for more information .
4
4
// Created by: Dmitri Maximov
5
5
// Created: 2011.06.10
6
6
@@ -21,8 +21,7 @@ namespace Xtensive.Orm.Security.Configuration
21
21
public class SecurityConfiguration : ConfigurationBase
22
22
{
23
23
/// <summary>
24
- /// Default SectionName value:
25
- /// "<see langword="Xtensive.Orm.Security" />".
24
+ /// Default section in configuration. Used if custom name is not provided.
26
25
/// </summary>
27
26
public const string DefaultSectionName = "Xtensive.Orm.Security" ;
28
27
@@ -119,14 +118,16 @@ private static SecurityConfiguration GetConfigurationFromSection(ConfigurationSe
119
118
var hashingService = configurationSection == null
120
119
? string . Empty
121
120
: configurationSection . HashingService . Name ;
122
- if ( ! string . IsNullOrEmpty ( hashingService ) )
121
+ if ( ! string . IsNullOrEmpty ( hashingService ) ) {
123
122
result . HashingServiceName = hashingService . ToLowerInvariant ( ) ;
123
+ }
124
124
125
125
var authenticationService = configurationSection == null
126
126
? string . Empty
127
127
: configurationSection . AuthenticationService . Name ;
128
- if ( ! string . IsNullOrEmpty ( authenticationService ) )
128
+ if ( ! string . IsNullOrEmpty ( authenticationService ) ) {
129
129
result . AuthenticationServiceName = authenticationService . ToLowerInvariant ( ) ;
130
+ }
130
131
131
132
return result ;
132
133
}
@@ -148,7 +149,7 @@ public static SecurityConfiguration Load(IConfiguration configuration, string se
148
149
return Load ( configurationSection ) ;
149
150
}
150
151
151
- throw new NotSupportedException ( "Type of configuration is not supported" ) ;
152
+ throw new NotSupportedException ( "Type of configuration is not supported. " ) ;
152
153
}
153
154
154
155
@@ -163,13 +164,12 @@ public static SecurityConfiguration Load(IConfigurationRoot configurationRoot, s
163
164
ArgumentValidator . EnsureArgumentNotNull ( configurationRoot , nameof ( configurationRoot ) ) ;
164
165
165
166
var configuration = new NamelessFormatSecurityConfigurationReader ( ) . Read ( configurationRoot , sectionName ?? DefaultSectionName ) ;
166
- if ( configuration != null )
167
+ if ( configuration != null ) {
167
168
return configuration ;
169
+ }
168
170
169
171
configuration = new BasedOnNamesFormatSecurityConfigurationReader ( ) . Read ( configurationRoot , sectionName ?? DefaultSectionName ) ;
170
- if ( configuration != null )
171
- return configuration ;
172
- return new SecurityConfiguration ( true ) ;
172
+ return configuration ?? new SecurityConfiguration ( true ) ;
173
173
}
174
174
175
175
/// <summary>
@@ -182,13 +182,12 @@ public static SecurityConfiguration Load(IConfigurationSection configurationSect
182
182
ArgumentValidator . EnsureArgumentNotNull ( configurationSection , nameof ( configurationSection ) ) ;
183
183
184
184
var configuration = new NamelessFormatSecurityConfigurationReader ( ) . Read ( configurationSection ) ;
185
- if ( configuration != null )
185
+ if ( configuration != null ) {
186
186
return configuration ;
187
+ }
187
188
188
189
configuration = new BasedOnNamesFormatSecurityConfigurationReader ( ) . Read ( configurationSection ) ;
189
- if ( configuration != null )
190
- return configuration ;
191
- return new SecurityConfiguration ( true ) ;
190
+ return configuration ?? new SecurityConfiguration ( true ) ;
192
191
}
193
192
194
193
/// <summary>
0 commit comments