Exemplo n.º 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));
 }
Exemplo n.º 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);
 }
Exemplo n.º 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);
 }
Exemplo n.º 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);
 }
Exemplo n.º 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);
Exemplo n.º 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);
 }
Exemplo n.º 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)
 {
 }
Exemplo n.º 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);
Exemplo n.º 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);
Exemplo n.º 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);