Inheritance: Rainy.WebService.RainyNoteServiceBase
Exemplo n.º 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);
            }
        }
Exemplo n.º 2
0
        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);
            }
        }
Exemplo n.º 3
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;
            }
        }
Exemplo n.º 4
0
        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;
            }
        }