Esempio n. 1
0
        /// <inheritdoc />
        public IAuthenticationService GetService(IVstsApplication application)
        {
            if (application == null)
            {
                throw new ArgumentNullException(nameof(application));
            }

            return(new AuthenticationService(application.Secret, application.RedirectUri));
        }
Esempio n. 2
0
        /// <summary>
        /// Initializes a new instance of the <see cref="LogOnCard"/> class.
        /// </summary>
        /// <param name="application">VSTS application information</param>
        /// <param name="channelId">The channelId.</param>
        /// <param name="userId">The userId.</param>
        public LogOnCard(IVstsApplication application, string channelId, string userId)
            : base(Labels.PleaseLogin)
        {
            application.ThrowIfNull(nameof(application));
            channelId.ThrowIfNullOrWhiteSpace(nameof(channelId));
            userId.ThrowIfNullOrWhiteSpace(nameof(userId));

            var button = new CardAction
            {
                Value = string.Format(CultureInfo.InvariantCulture, UrlOAuth, application.Id, channelId, userId, application.Scope, application.RedirectUri),
                Type  = string.Equals(channelId, ChannelIds.Msteams, StringComparison.Ordinal) ? ActionTypes.OpenUrl : ActionTypes.Signin,
                Title = Labels.AuthenticationRequired
            };

            this.Buttons = new List <CardAction> {
                button
            };
        }