protected internal virtual async Task ValidateAuthenticationSchemeAsync(AuthenticationSchemeKind expectedKind, string name) { if (name == null) { throw new ArgumentNullException(nameof(name)); } var authenticationScheme = await this.Facade.AuthenticationSchemeRetriever.GetAsync(name); if (authenticationScheme == null) { throw new InvalidOperationException($"The authentication-scheme \"{name}\" does not exist."); } if (!authenticationScheme.Enabled) { throw new InvalidOperationException($"The authentication-scheme \"{name}\" is not enabled."); } if (!authenticationScheme.Interactive) { throw new InvalidOperationException($"The authentication-scheme \"{name}\" is not interactive."); } if (authenticationScheme.Kind != expectedKind) { throw new InvalidOperationException($"The authentication-scheme \"{name}\" is not of kind \"{expectedKind}\"."); } }
protected internal virtual void ValidateAuthenticationScheme(string authenticationSchemeName, AuthenticationSchemeKind kind) { if (authenticationSchemeName == null) { throw new ArgumentNullException(nameof(authenticationSchemeName)); } var authenticationScheme = this.AuthenticationSchemeLoader.GetAsync(authenticationSchemeName).Result; if (authenticationScheme == null) { throw new InvalidOperationException($"The authentication-scheme \"{authenticationSchemeName}\" does not exist."); } if (!authenticationScheme.Enabled) { throw new InvalidOperationException($"The authentication-scheme \"{authenticationSchemeName}\" is not enabled."); } if (!authenticationScheme.Interactive) { throw new InvalidOperationException($"The authentication-scheme \"{authenticationSchemeName}\" is not interactive."); } if (authenticationScheme.Kind != kind) { throw new InvalidOperationException($"The authentication-scheme \"{authenticationSchemeName}\" is not of kind \"{kind}\"."); } }
protected internal virtual async Task <string> ResolveAndValidateAsync(string authenticationScheme, AuthenticationSchemeKind expectedAuthenticationSchemeKind, string returnUrl) { await this.ValidateAuthenticationSchemeAsync(expectedAuthenticationSchemeKind, authenticationScheme); returnUrl = this.ResolveAndValidateReturnUrl(returnUrl); await this.ValidateAuthenticationSchemeForClientAsync(authenticationScheme, returnUrl); return(returnUrl); }