Ejemplo n.º 1
0
        internal AuthLogger(
            LogLevel logLevel,
            bool enablePiiLogging,
            bool isDefaultPlatformLoggingEnabled,
            LogCallback loggingCallback)
        {
            PiiLoggingEnabled = enablePiiLogging;
            _loggingCallback  = loggingCallback;
            _logLevel         = logLevel;
            _isDefaultPlatformLoggingEnabled = isDefaultPlatformLoggingEnabled;

            _platformLogger = PlatformProxyFactory.CreatePlatformProxy(null).PlatformLogger;

            ClientInformation = string.Empty;
        }
        /// <summary>
        /// Initializes a new instance of the <see cref="UserAssertion"/> class.
        /// Constructor of a UserAssertion specifying the assertionType in addition to the assertion.
        /// </summary>
        /// <param name="assertion">Assertion representing the user.</param>
        /// <param name="assertionType">Type of the assertion representing the user. Accepted types are currently:
        /// <list type="bullet">
        /// <item>urn:ietf:params:oauth:grant-type:jwt-bearer<term></term><description>JWT bearer token. Passing this is equivalent to using
        /// the other (simpler) constructor</description></item>
        /// <item>urn:ietf:params:oauth:grant-type:saml1_1-bearer<term></term><description>SAML 1.1 bearer token</description></item>
        /// <item>urn:ietf:params:oauth:grant-type:jwt-bearer<term></term><description>SAML 2 bearer token</description></item>
        /// </list></param>
        public UserAssertion(string assertion, string assertionType)
        {
            if (string.IsNullOrWhiteSpace(assertion))
            {
                throw new ArgumentNullException(nameof(assertion));
            }

            if (string.IsNullOrWhiteSpace(assertionType))
            {
                throw new ArgumentNullException(nameof(assertionType));
            }

            var crypto = PlatformProxyFactory.CreatePlatformProxy(null).CryptographyManager;

            AssertionType = assertionType;
            Assertion     = assertion;
            AssertionHash =
                crypto.CreateBase64UrlEncodedSha256Hash(Assertion);
        }