コード例 #1
0
        /// <summary>
        /// Initializes a new instance of the <see cref="UserPartnerCredentials" /> class.
        /// </summary>
        /// <param name="aadApplicationId">The id of the application in Azure Active Directory.</param>
        /// <param name="aadAuthenticationToken">The Azure Active Directory token.</param>
        /// <param name="aadTokenRefresher">An optional delegate which will be called when the Azure Active Directory token
        /// expires and can no longer be used to generate the partner credentials. This delegate should return
        /// an up to date Azure Active Directory token.</param>
        public UserPartnerCredentials(string aadApplicationId, AuthenticationToken aadAuthenticationToken, TokenRefresher aadTokenRefresher = null)
            : base(aadApplicationId)
        {
            aadAuthenticationToken.AssertNotNull(nameof(aadAuthenticationToken));

            if (aadAuthenticationToken.IsExpired())
            {
                throw new ArgumentException(Resources.AuthenticationTokenExpired);
            }

            AADToken       = aadAuthenticationToken;
            tokenRefresher = aadTokenRefresher;
        }