TokenExchangeAfterAuthentication() public method

public TokenExchangeAfterAuthentication ( string username, string password, string token ) : object
username string
password string
token string
return object
コード例 #1
0
        public object Get(OAuthAuthorizeRequest request)
        {
            if (!string.IsNullOrEmpty(request.Username) &&
                !string.IsNullOrEmpty(request.Password))
            {
                // unattended authentication, immediately perform token exchange
                // and use data from the querystring

                bool is_allowed = RainyStandaloneServer.OAuth.Authenticator(request.Username, request.Password);
                if (!is_allowed)
                {
                    throw new UnauthorizedException();
                }

                var auth_service = new OAuthAuthenticateService();
                var resp         = (OAuthAuthenticateResponse)auth_service.TokenExchangeAfterAuthentication(
                    request.Username,
                    request.Password,
                    Request.QueryString["oauth_token"]
                    );
                Response.Redirect(resp.RedirectUrl);
                return(null);
            }
            else
            {
                TextReader reader = new StreamReader("/Users/td/gateway.html");
                string     resp   = reader.ReadToEnd();
                reader.Close();
                return(resp);
            }
        }
コード例 #2
0
ファイル: OAuthService.cs プロジェクト: gmstrbytes/Rainy
        public object Any(OAuthAuthorizeRequest request)
        {
            if (!string.IsNullOrEmpty(request.Username) &&
                !string.IsNullOrEmpty(request.Password))
            {
                // unattended authentication, immediately perform token exchange
                // and use data from the querystring

                bool is_allowed = authenticator.VerifyCredentials(request.Username, request.Password);
                if (!is_allowed)
                {
                    throw new UnauthorizedException();
                }

                var auth_service = new OAuthAuthenticateService(connFactory, oauthHandler, authenticator);
                var resp         = (OAuthAuthenticateResponse)auth_service.TokenExchangeAfterAuthentication(
                    request.Username,
                    request.Password,
                    Request.QueryString["oauth_token"]
                    );
                Response.Redirect(resp.RedirectUrl);
                return(null);
            }
            else
            {
                // take all url parameters and redirect to the login page
                string prams = new Uri(Request.RawUrl).PathAndQuery.Split(new char[] { '?' })[1];
                Response.Redirect("/admin/#/login?" + prams);
                Response.EndServiceStackRequest();
                return(null);
            }
        }
コード例 #3
0
ファイル: OAuthService.cs プロジェクト: BooTeK/Rainy
        public object Get(OAuthAuthorizeRequest request)
        {
            if (!string.IsNullOrEmpty (request.Username) &&
                !string.IsNullOrEmpty (request.Password)) {

                // unattended authentication, immediately perform token exchange
                // and use data from the querystring

                bool is_allowed = RainyStandaloneServer.OAuth.Authenticator (request.Username, request.Password);
                if (!is_allowed) {
                    throw new UnauthorizedException ();
                }

                var auth_service = new OAuthAuthenticateService ();
                var resp = (OAuthAuthenticateResponse) auth_service.TokenExchangeAfterAuthentication (
                    request.Username,
                    request.Password,
                    Request.QueryString["oauth_token"]
                );
                Response.Redirect (resp.RedirectUrl);
                return null;
            } else {
                TextReader reader = new StreamReader ("/Users/td/gateway.html");
                string resp = reader.ReadToEnd ();
                reader.Close ();
                return resp;
            }
        }
コード例 #4
0
ファイル: OAuthService.cs プロジェクト: Dynalon/Rainy
        public object Any(OAuthAuthorizeRequest request)
        {
            if (!string.IsNullOrEmpty (request.Username) &&
                !string.IsNullOrEmpty (request.Password)) {

                // unattended authentication, immediately perform token exchange
                // and use data from the querystring

                bool is_allowed = authenticator.VerifyCredentials (request.Username, request.Password);
                if (!is_allowed) {
                    throw new UnauthorizedException ();
                }

                var auth_service = new OAuthAuthenticateService (connFactory, oauthHandler, authenticator);
                var resp = (OAuthAuthenticateResponse) auth_service.TokenExchangeAfterAuthentication (
                    request.Username,
                    request.Password,
                    Request.QueryString["oauth_token"]
                );
                Response.Redirect (resp.RedirectUrl);
                return null;
            } else {
                // take all url parameters and redirect to the login page
                string prams =  new Uri (Request.RawUrl).PathAndQuery.Split (new char[] { '?' })[1];
                Response.Redirect ("/admin/#/login?" + prams);
                Response.EndServiceStackRequest ();
                return null;
            }
        }