Example #1
0
        public RequestStateKey(OAuthService service, string endUserId)
        {
            if (service == null)
            {
                throw new ArgumentNullException("service");
            }

            string serviceRealm = null;

            if (!String.IsNullOrEmpty(service.Realm))
            {
                serviceRealm = service.Realm;
            }
            else if (service.AuthorizationUrl != null)
            {
                serviceRealm = service.AuthorizationUrl.AbsoluteUri;
            }
            else
            {
                throw new ArgumentException("Service does not have realm or authorization URI", "service");
            }

            if (service.Consumer == null || String.IsNullOrEmpty(service.Consumer.Key))
            {
                throw new ArgumentException("Service does not have consumer key", "service");
            }

            this.serviceRealm = serviceRealm;
            consumerKey       = service.Consumer.Key;
            this.endUserId    = endUserId;
        }
Example #2
0
 public bool Equals(OAuthService other)
 {
     return(other != null && requestTokenEndPoint.Equals(other.RequestTokenUrl) &&
            authorizationUrl.Equals(other.AuthorizationUrl) && accessTokenEndPoint.Equals(other.AccessTokenUrl) &&
            useAuthorizationHeader == other.UseAuthorizationHeader && String.Equals(realm, other.Realm) &&
            String.Equals(signatureMethod, other.SignatureMethod) && String.Equals(version, other.OAuthVersion) &&
            consumer.Equals(other.Consumer));
 }
Example #3
0
        public override bool Equals(object obj)
        {
            if (ReferenceEquals(this, obj))
            {
                return(true);
            }

            OAuthService other = obj as OAuthService;

            if (other == null)
            {
                return(false);
            }

            return(Equals(other));
        }
Example #4
0
        public void TestSuccess1()
        {
            OAuthService       service       = new OAuthService(new OAuthEndPoint(RequestTokenAddress), AuthorizationAddress, new OAuthEndPoint(AccessTokenAddress), Consumer);
            OAuthClientContext clientContext = new OAuthClientContext(service);

            clientContext.NonceGenerator = new GuidNonceGenerator();

            UriBuilder builder = new UriBuilder();

            builder.Scheme = Uri.UriSchemeHttp;
            builder.Host   = PathServiceAddress.Host;
            builder.Port   = PathServiceAddress.Port;
            builder.Path   = PathName;

            OAuthRequest  consumerRequest = clientContext.CreateRequest(new OAuthEndPoint(builder.ToString(), "GET"));
            OAuthResponse resource        = consumerRequest.GetResource();

            if (resource.HasProtectedResource)
            {
                //TODO:
            }
        }
 public OAuthClientContext(OAuthService service)
 {
     this.service = service;
 }
Example #6
0
 public bool Equals(OAuthService other)
 {
     return other != null && requestTokenEndPoint.Equals(other.RequestTokenUrl) &&
            authorizationUrl.Equals(other.AuthorizationUrl) && accessTokenEndPoint.Equals(other.AccessTokenUrl) &&
            useAuthorizationHeader == other.UseAuthorizationHeader && String.Equals(realm, other.Realm) &&
            String.Equals(signatureMethod, other.SignatureMethod) && String.Equals(version, other.OAuthVersion) &&
            consumer.Equals(other.Consumer);
 }
        public void TestSuccess1()
        {
            OAuthService service = new OAuthService(new OAuthEndPoint(RequestTokenAddress), AuthorizationAddress, new OAuthEndPoint(AccessTokenAddress), Consumer);
            OAuthClientContext clientContext = new OAuthClientContext(service);
            clientContext.NonceGenerator = new GuidNonceGenerator();

            UriBuilder builder = new UriBuilder();
            builder.Scheme = Uri.UriSchemeHttp;
            builder.Host = PathServiceAddress.Host;
            builder.Port = PathServiceAddress.Port;
            builder.Path = PathName;

            OAuthRequest consumerRequest = clientContext.CreateRequest(new OAuthEndPoint(builder.ToString(), "GET"));
            OAuthResponse resource = consumerRequest.GetResource();

            if (resource.HasProtectedResource) {
                //TODO:
            }
        }
Example #8
0
 public OAuthClientContext(OAuthService service)
 {
     this.service = service;
 }