public static ITokenAdapter CreateTokenAdapter()

in wwauth/Google.Solutions.WWAuth/Adapters/AdapterFactory.cs [42:84]


        public static ITokenAdapter CreateTokenAdapter(
            UnattendedCommandLineOptions options,
            ILogger logger)
        {
            switch (options.Protocol)
            {
                case UnattendedCommandLineOptions.AuthenticationProtocol.AdfsOidc:
                    options.IssuerUrl.ThrowIfNull(nameof(UnattendedCommandLineOptions.IssuerUrl));
                    options.OidcClientId.ThrowIfNull(nameof(UnattendedCommandLineOptions.OidcClientId));
                    options.RelyingPartyId.ThrowIfNull(nameof(UnattendedCommandLineOptions.RelyingPartyId));

                    return new AdfsOidcAdapter(
                        new Uri(options.IssuerUrl),
                        options.OidcClientId,
                        options.RelyingPartyId,
                        logger);

                case UnattendedCommandLineOptions.AuthenticationProtocol.AdfsWsTrust:
                    options.IssuerUrl.ThrowIfNull(nameof(UnattendedCommandLineOptions.IssuerUrl));
                    options.RelyingPartyId.ThrowIfNull(nameof(UnattendedCommandLineOptions.RelyingPartyId));

                    return new AdfsWsTrustAdapter(
                        new Uri(options.IssuerUrl),
                        options.RelyingPartyId,
                        logger);

                case UnattendedCommandLineOptions.AuthenticationProtocol.AdfsSamlPost:
                    options.IssuerUrl.ThrowIfNull(nameof(UnattendedCommandLineOptions.IssuerUrl));
                    options.RelyingPartyId.ThrowIfNull(nameof(UnattendedCommandLineOptions.RelyingPartyId));

                    return new AdfsSamlPostAdapter(
                        new Uri(options.IssuerUrl),
                        options.RelyingPartyId,
                        options.SamlAcsUrl,
                        string.IsNullOrEmpty(options.SamlRequestSigningCertificate)
                            ? null
                            : GetCertificate(options.SamlRequestSigningCertificate),
                        logger);

                default:
                    throw new ArgumentException("Unknown protocol: " + options.Protocol);
            }
        }