/// <summary>Gets the <see cref="ImgurAuthenticatedContext"/> for the current authentication session.</summary>
        /// <param name="authenticationResponse">The <see cref="AuthenticationResponse"/> returned by imgur.</param>
        /// <param name="identity">The <see cref="ClaimsIdentity"/> for the identity of the user.</param>
        /// <param name="properties">The <see cref="AuthenticationProperties"/> for the current authentication session.</param>
        /// <returns>The <see cref="ImgurAuthenticatedContext"/> for the current authentication session.</returns>
        private ImgurAuthenticatedContext GetImgurAuthenticatedContext(AuthenticationResponse authenticationResponse, ClaimsIdentity identity, AuthenticationProperties properties)
        {
            var context = new ImgurAuthenticatedContext(this.Context, this.Options);

            context.AccessToken     = authenticationResponse.AccessToken;
            context.AccountId       = authenticationResponse.AccountId;
            context.AccountUsername = authenticationResponse.AccountUsername;
            context.ExpiresIn       = authenticationResponse.ExpiresIn;
            context.Identity        = identity;
            context.Properties      = properties;
            context.RefreshToken    = authenticationResponse.RefreshToken;
            context.Scope           = authenticationResponse.Scope;
            context.TokenType       = authenticationResponse.TokenType;

            return(context);
        }
Пример #2
0
        /// <summary>Gets the <see cref="ImgurAuthenticatedContext"/> for the current authentication session.</summary>
        /// <param name="authenticationResponse">The <see cref="AuthenticationResponse"/> returned by imgur.</param>
        /// <param name="identity">The <see cref="ClaimsIdentity"/> for the identity of the user.</param>
        /// <param name="properties">The <see cref="AuthenticationProperties"/> for the current authentication session.</param>
        /// <returns>The <see cref="ImgurAuthenticatedContext"/> for the current authentication session.</returns>
        private ImgurAuthenticatedContext GetImgurAuthenticatedContext(AuthenticationResponse authenticationResponse, ClaimsIdentity identity, AuthenticationProperties properties)
        {
            var context = new ImgurAuthenticatedContext(Context, Options)
            {
                AccessToken     = authenticationResponse.AccessToken,
                AccountId       = authenticationResponse.AccountId,
                AccountUsername = authenticationResponse.AccountUsername,
                ExpiresIn       = authenticationResponse.ExpiresIn,
                Identity        = identity,
                Properties      = properties,
                RefreshToken    = authenticationResponse.RefreshToken,
                Scope           = authenticationResponse.Scope,
                TokenType       = authenticationResponse.TokenType
            };

            return(context);
        }
 /// <summary>Invoked whenever imgur successfully authenticates a user.</summary>
 /// <param name="context">The <see cref="ImgurAuthenticatedContext"/> that contains information about the login session and the user's <see cref="System.Security.Claims.ClaimsIdentity"/>.</param>
 /// <returns>A <see cref="Task"/> representing the completed operation.</returns>
 public Task Authenticated(ImgurAuthenticatedContext context)
 {
     return OnAuthenticated(context);
 }