Пример #1
0
 /// <summary>
 ///   Fluent API to assign the two endpoint properties
 ///   (<see cref="AuthConfig.Authority"/> and <see cref="AuthConfig.TokenIssuer"/>).
 /// </summary>
 /// <returns>
 ///   <c>this</c>
 /// </returns>
 public static AuthConfig WithEndpoints(this AuthConfig self, Uri authorityUri, Uri tokenIssuer)
 {
     return(self.WithAuthority(authorityUri).WithTokenIssuer(tokenIssuer));
 }
Пример #2
0
 /// <summary>
 ///   Clears the <see cref="AuthConfig.Scope"/> value.
 /// </summary>
 /// <returns>
 ///   <c>this</c>
 /// </returns>
 public static AuthConfig ClearScope(this AuthConfig self)
 {
     self.Scope = null;
     return(self);
 }
Пример #3
0
 /// <summary>
 ///   Fluent API to assign the <see cref="AuthConfig.Authority"/>.
 /// </summary>
 /// <returns>
 ///   <c>this</c>
 /// </returns>
 public static AuthConfig WithAuthority(this AuthConfig self, Uri authorityUri)
 {
     self.Authority = authorityUri;
     return(self);
 }
Пример #4
0
 /// <summary>
 ///   Fluent API to assign the <see cref="AuthConfig.TokenIssuer"/>.
 /// </summary>
 /// <returns>
 ///   <c>this</c>
 /// </returns>
 public static AuthConfig WithTokenIssuer(this AuthConfig self, Uri tokenIssuer)
 {
     self.TokenIssuer = tokenIssuer;
     return(self);
 }
Пример #5
0
 /// <summary>
 ///   Removes one or more scope types from the <see cref="AuthConfig.Scope"/> value.
 /// </summary>
 /// <returns>
 ///   <c>this</c>
 /// </returns>
 public static AuthConfig RemoveScope(this AuthConfig self, AuthScope scope) => self.RemoveScope(scope.Items);
Пример #6
0
 /// <summary>
 ///   Replaces the default <see cref="TokenCache"/> with a (custom) one.
 /// </summary>
 /// <returns>
 ///   <c>this</c>
 /// </returns>
 public static AuthConfig WithTokenCache(this AuthConfig self, TokenCache tokenCache)
 {
     self.TokenCache = tokenCache;
     return(self);
 }
Пример #7
0
 /// <summary>
 ///   Adds one or more scope types (not already supported) to the <see cref="AuthConfig.Scope"/> value.
 /// </summary>
 /// <returns>
 ///   <c>this</c>
 /// </returns>
 public static AuthConfig AddScope(this AuthConfig self, AuthScope scope) => self.AddScope(scope.Items);
 /// <summary>
 ///   Initializes the authenticator.
 /// </summary>
 /// <param name="config">
 ///   Contains the configuration.
 /// </param>
 /// <param name="log">
 ///   (optional)<br/>
 ///   A log to be used for logging internal operations and events-
 /// </param>
 public TetraPakAuthenticator(AuthConfig config, ILog log = null) : base(config, log)
 {
 }
Пример #9
0
 /// <summary>
 ///   Resolves and returns a suitable authenticator.
 /// </summary>
 /// <param name="application">
 ///   A <see cref="AuthApplication"/> descriptor value.
 ///   Can be passed as a string.
 /// </param>
 /// <param name="log">
 ///   (optional)<br/>
 ///   A logger, for diagnostics purposes.
 /// </param>
 /// <returns>
 ///   An authenticator (implements <see cref="IAuthenticator"/>).
 /// </returns>
 /// <returns>
 ///   An authenticator (implements <see cref="IAuthenticator"/>).
 /// </returns>
 public static IAuthenticator GetAuthenticator(AuthApplication application, ILog log = null)
 => GetAuthenticator(AuthConfig.Default(application), log);
Пример #10
0
 /// <summary>
 ///   Resolves and returns a suitable authenticator.
 /// </summary>
 /// <param name="config">
 ///   The app configuration (<see cref="AuthConfig"/>).
 /// </param>
 /// <param name="log">
 ///   (optional)<br/>
 ///   A logger, for diagnostics purposes.
 /// </param>
 /// <returns>
 ///   An authenticator (implements <see cref="IAuthenticator"/>).
 /// </returns>
 public static IAuthenticator GetAuthenticator(AuthConfig config, ILog log = null)
 => new TetraPakAuthenticator(config, log);
Пример #11
0
 /// <summary>
 ///   Resolves and returns a suitable authenticator.
 /// </summary>
 /// <param name="clientId">
 ///   Specifies the client id (a.k.a. app id).
 /// </param>
 /// <param name="redirectUri">
 ///   Specifies the redirect <see cref="Uri"/>.
 /// </param>
 /// <param name="environment">
 ///   (optional; default = <see cref="RuntimeEnvironment.Production"/>)<br/>
 ///   Specifies the targeted runtime environment.
 /// </param>
 /// <param name="log">
 ///   (optional)<br/>
 ///   A logger, for diagnostics purposes.
 /// </param>
 /// <returns>
 ///   An authenticator (implements <see cref="IAuthenticator"/>).
 /// </returns>
 public static IAuthenticator GetAuthenticator(
     string clientId, Uri redirectUri,
     RuntimeEnvironment environment = RuntimeEnvironment.Production, ILog log = null)
 => GetAuthenticator(AuthConfig.Default(environment, clientId, redirectUri), log);