public AuthenticationResult VerifyAuthentication(HttpContextBase context)
        {
            var url      = CreateUserInfoUrl(context);
            var request  = OAuthHelpers.Load(url);
            var userData = CreateUserInfo(request);

            return(OAuthHelpers.CreateAuthenticationResult(ProviderName, userData));
        }
Beispiel #2
0
        public AuthenticationResult VerifyAuthentication(HttpContextBase context)
        {
            var url      = CreateAccessTokenUrl(context);
            var response = OAuthHelpers.Load(url);

            RegenerateSignatureKey(response);
            var userInfo = GetUserData(OAuthHelpers.GetValueFromRequest(response, "oauth_token"));

            return(OAuthHelpers.CreateAuthenticationResult(ProviderName, userInfo));
        }
        public void RequestAuthentication(HttpContextBase context, Uri returnUrl)
        {
            var requestTokenUrl = CreateRequestTokenUrl(returnUrl);
            var response        = OAuthHelpers.Load(requestTokenUrl);

            RegenerateSignatureKey(response);

            var url = OAuthHelpers.BuildUri(FlickrUrl, "services/oauth/authorize", new NameValueCollection {
                { "oauth_token", HttpUtility.ParseQueryString(response).Get("oauth_token") }
            });

            context.Response.Redirect(url, false);
        }
Beispiel #4
0
        public AuthenticationResult VerifyAuthentication(HttpContextBase context)
        {
            var url             = CreateUserInfoUrl(context);
            var response        = OAuthHelpers.Load(url);
            var queryCollection = HttpUtility.ParseQueryString(response);

            var userInfo = new UserInfo {
                Id       = queryCollection.Get("user_id"),
                UserName = queryCollection.Get("screen_name")
            };

            return(OAuthHelpers.CreateAuthenticationResult(ProviderName, userInfo));
        }
Beispiel #5
0
        public void RequestAuthentication(HttpContextBase context, Uri returnUrl)
        {
            var requestTokenUrl = CreateRequestTokenUrl(returnUrl);
            var response        = OAuthHelpers.Load(requestTokenUrl);

            RegenerateSignatureKey(response);

            var url = OAuthHelpers.BuildUri(TumblrUrl, "oauth/authorize", new NameValueCollection {
                { "oauth_token", OAuthHelpers.GetValueFromRequest(response, "oauth_token") }
            });

            context.Response.Redirect(url, false);
        }
Beispiel #6
0
        public void RequestAuthentication(HttpContextBase context, Uri returnUrl)
        {
            _redirectUri = returnUrl.AbsoluteUri;

            var url          = CreateRequestTokenUrl();
            var request      = OAuthHelpers.Load(url);
            var requestToken = OAuthHelpers.GetValueFromRequest(request, "oauth_token");

            _tokenSecret        = OAuthHelpers.GetValueFromRequest(request, "oauth_token_secret");
            _signatureGenerator = new SignatureGenerator(_appSecret, _tokenSecret);

            var redirectUrl = CreateRedirectUrl(requestToken);

            context.Response.Redirect(redirectUrl, false);
        }
Beispiel #7
0
        private string GetAccessToken(string authorizationCode, Uri returnUrl)
        {
            var url = CreateAccessTokenUrl(authorizationCode, returnUrl);

            return(HttpUtility.ParseQueryString(OAuthHelpers.Load(url)).Get("access_token"));
        }