Example #1
0
 public object Post(OAuthRequestTokenRequest request)
 {
     // i.e. ConBoy only supported POST Auth which is valid accoding to the OAuth RFC, but not yet
     // supported in Rainy
     throw new RainyBaseException () {ErrorMessage = "Usage of POST for OAuth authorization is currently not supported. Use GET instead."};
 }
Example #2
0
        public object Get(OAuthRequestTokenRequest request)
        {
            HttpWebRequest original_request = ((HttpListenerRequest)Request.OriginalRequest).ToWebRequest ();

            // it is not fatal that we do not really check the oauth signature for the request token request
            // all it takes to sign such a request is the consumer secret, which is "anyone" and hard-coded
            // into the tomboy and rainy source code - and we are open source so everybody knows it anyways
            IOAuthContext context;
            context = new OAuthContextBuilder ().FromWebRequest (original_request, request.RequestStream);

            IToken token = oauthHandler.Provider.GrantRequestToken (context);
            Logger.DebugFormat ("granting request token {0} to consumer", token);
            Response.StatusCode = 200;
            Response.Write (token.ToString ());
            Response.End ();

            return null;
        }
Example #3
0
        public object Get(OAuthRequestTokenRequest request)
        {
            // keep this line to inspect the Request in monodevelop's debugger
            // really helps debugging API calls
            var servicestack_http_request = Request;

            HttpWebRequest original_request = ((HttpListenerRequest)Request.OriginalRequest).ToWebRequest ();

            IOAuthContext context = new OAuthContextBuilder ().FromWebRequest (original_request, request.RequestStream);
            IToken token = RainyStandaloneServer.OAuth.Provider.GrantRequestToken (context);
            Logger.DebugFormat ("granting request token {0} to consumer", token);
            Response.StatusCode = 200;
            Response.Write (token.ToString ());
            Response.End ();

            return null;
        }
Example #4
0
        public object Any(OAuthRequestTokenRequest request)
        {
            // keep this line to inspect the Request in monodevelop's debugger
            // really helps debugging API calls
            var servicestack_http_request = Request;

            HttpWebRequest original_request = ((HttpListenerRequest)Request.OriginalRequest).ToWebRequest ();

            try {
                IOAuthContext context = new OAuthContextBuilder ().FromWebRequest (original_request, request.RequestStream);
                IToken token = RainyStandaloneServer.OAuth.Provider.GrantRequestToken (context);
                Logger.DebugFormat ("granting request token {0} to consumer", token);

                Response.StatusCode = 200;
                Response.Write (token.ToString ());
            } catch (Exception e) {
                Logger.ErrorFormat ("Caught exception: {0}", e.Message);
                Response.StatusCode = 500;
                Response.StatusDescription = e.Message;
            } finally {
                Response.Close ();
            }
            return null;
        }