@@ -107,11 +107,6 @@ private AuthTokenValidationConfiguration(AuthTokenValidationConfiguration other)
107107
108108 private static void RequirePositiveTimeSpan ( TimeSpan timeSpan , string fieldName )
109109 {
110- if ( timeSpan == null )
111- {
112- throw new ArgumentNullException ( $ "{ fieldName } must not be null") ;
113- }
114-
115110 if ( timeSpan . IsNegativeOrZero ( ) )
116111 {
117112 throw new ArgumentOutOfRangeException ( nameof ( timeSpan ) , $ "{ fieldName } must be greater than zero") ;
@@ -125,9 +120,7 @@ private static void RequirePositiveTimeSpan(TimeSpan timeSpan, string fieldName)
125120 /// <exception cref="ArgumentException">When required parameters are null</exception>
126121 public void Validate ( )
127122 {
128- if ( this . SiteOrigin == null )
129- { throw new ArgumentNullException ( nameof ( this . SiteOrigin ) ) ; }
130- ValidateIsOriginURL ( this . SiteOrigin ) ;
123+ ValidateSiteOriginURL ( this . SiteOrigin ) ;
131124
132125 if ( ! this . TrustedCaCertificates . Any ( ) )
133126 { throw new ArgumentException ( "At least one trusted certificate authority must be provided" ) ; }
@@ -142,17 +135,23 @@ public void Validate()
142135 /// Validates that the given URI is an origin URL as defined in <a href="https://developer.mozilla.org/en-US/docs/Web/API/Location/origin">MDN</a>,
143136 /// in the form of <![CDATA[<code> <scheme> "://" <hostname> [ ":" <port> ]</code>]]>.
144137 /// </summary>
145- /// <param name="uri">URI with origin URL</param>
138+ /// <param name="siteOrigin">URI with origin URL</param>
139+ /// <exception cref="ArgumentNullException">When siteOrigin parameter is null</exception>
146140 /// <exception cref="ArgumentException">When the URI is not in the form of origin URL</exception>
147- private static void ValidateIsOriginURL ( Uri uri )
141+ private static void ValidateSiteOriginURL ( Uri siteOrigin )
148142 {
143+ if ( siteOrigin == null )
144+ {
145+ throw new ArgumentNullException ( nameof ( siteOrigin ) ) ;
146+ }
147+
149148 try
150149 {
151150 // 1. Verify that the URI can be converted to absolute URL.
152- if ( ! uri . IsAbsoluteUri )
151+ if ( ! siteOrigin . IsAbsoluteUri )
153152 { throw new ArgumentException ( "Provided URI is not a valid URL" ) ; }
154153 // 2. Verify that the URI contains only HTTPS scheme, host and optional port components.
155- if ( ! new Uri ( $ "https://{ uri . Host } :{ uri . Port } ") . Equals ( uri ) )
154+ if ( ! new Uri ( $ "https://{ siteOrigin . Host } :{ siteOrigin . Port } ") . Equals ( siteOrigin ) )
156155 { throw new ArgumentException ( "Origin URI must only contain the HTTPS scheme, host and optional port component" ) ; }
157156 }
158157 catch ( InvalidOperationException e )
0 commit comments