C# Class pokitdokcsharp.OauthApplicationClient

Oauth 2.0 Client implementing Client Credentials Grant Authorization http://tools.ietf.org/html/rfc6749#section-4.4
Mostrar archivo Open project: pokitdok/pokitdok-csharp

Public Properties

Property Type Description
_accessTokenRenewer System.Threading.Timer

Public Methods

Method Description
Authenticate ( ) : OauthAccessToken

Get an access token and setup a timer to refresh the token

CreateRequest ( object>.Dictionary data, string url, string method, string content_type = "application/json" ) : HttpWebRequest

Forms the HttpWebRequest

DeAuthenticate ( ) : OauthAccessToken

Calls an endpoint on the PokitDok server to remove client access tokens.

DeleteRequest ( string requestPath ) : ResponseData

Perform a DELETE request for the given resource

GetRequest ( string requestPath, string>.Dictionary parameters = null ) : ResponseData

Perform a GET request given the http request path and a dictionary of query parameters.

OauthApplicationClient ( string clientId, string clientSecret, int requestTimeout = DEFAULT_TIMEOUT, OauthAccessToken accessToken = null, Uri redirectUrl = null, TokenRefreshDelegate tokenRefresh = null, string scope = null, string authCode = null ) : System

Initializes a new instance of the pokitdokcsharp.OauthApplicationClient class.

PostRequest ( string requestPath, object>.Dictionary postData ) : ResponseData

Perform a POST request given the http request path and a dictionary representing the JSON post body.

PostRequest ( string requestPath, string postFilePath, string postFileContentDispositionName, string postFileContentType, string>.Dictionary parameters = null ) : ResponseData

Perform a POST request given the http request path and a file to post with optional form field parameters.

PutRequest ( string requestPath, object>.Dictionary putData ) : ResponseData

Perform a PUT request given the uri and put data form fields

Private Methods

Method Description
AuthenticateAuthorizationCode ( ) : OauthAccessToken
AuthenticateClientCredentials ( ) : OauthAccessToken
AuthenticateRefreshToken ( ) : OauthAccessToken
AuthenticateRequest ( WebRequest webRequest, byte request_bytes ) : OauthAccessToken
GetPostStream ( string filePath, string fileContentType, string fileContentDispositionName, NameValueCollection formData, string boundary ) : Stream

Builds a Stream of multipart form data from file and form fields.

OnTokenExpiredCallback ( object stateInfo ) : void

Raises the token expired callback event.

ProcessResponse ( HttpWebResponse response ) : ResponseData

Processes the http response into a pokitdokcsharp.ResponseData object.

isAccessTokenExpired ( ) : bool

Check if the access token is expired

Method Details

Authenticate() public method

Get an access token and setup a timer to refresh the token
Thrown when authentication fails or /// when some unknown system error occurs.
public Authenticate ( ) : OauthAccessToken
return OauthAccessToken

CreateRequest() public method

Forms the HttpWebRequest
public CreateRequest ( object>.Dictionary data, string url, string method, string content_type = "application/json" ) : HttpWebRequest
data object>.Dictionary data to be converted to JSON. Need to know the length
url string URL
method string post, put, delete, get
content_type string should always be application/json (default)
return System.Net.HttpWebRequest

DeAuthenticate() public method

Calls an endpoint on the PokitDok server to remove client access tokens.
public DeAuthenticate ( ) : OauthAccessToken
return OauthAccessToken

DeleteRequest() public method

Perform a DELETE request for the given resource
public DeleteRequest ( string requestPath ) : ResponseData
requestPath string Request path/resource
return ResponseData

GetRequest() public method

Perform a GET request given the http request path and a dictionary of query parameters.
Thrown when unknown system error occurs.
public GetRequest ( string requestPath, string>.Dictionary parameters = null ) : ResponseData
requestPath string Request path.
parameters string>.Dictionary Dictionary of query parameters.
return ResponseData

OauthApplicationClient() public method

Initializes a new instance of the pokitdokcsharp.OauthApplicationClient class.
public OauthApplicationClient ( string clientId, string clientSecret, int requestTimeout = DEFAULT_TIMEOUT, OauthAccessToken accessToken = null, Uri redirectUrl = null, TokenRefreshDelegate tokenRefresh = null, string scope = null, string authCode = null ) : System
clientId string Client identifier.
clientSecret string Client secret.
requestTimeout int Request timeout.
accessToken OauthAccessToken Access token.
redirectUrl System.Uri The Platform App redirect url.
tokenRefresh TokenRefreshDelegate Invoked when access token is refreshed.
scope string The requested scopes
authCode string The authorization code recieved by the scope grant of the Platform App
return System

PostRequest() public method

Perform a POST request given the http request path and a dictionary representing the JSON post body.
Thrown when unknown system error occurs.
public PostRequest ( string requestPath, object>.Dictionary postData ) : ResponseData
requestPath string Request path.
postData object>.Dictionary Post data: dictionary representing JSON data
return ResponseData

PostRequest() public method

Perform a POST request given the http request path and a file to post with optional form field parameters.
Thrown when unknown system error occurs.
public PostRequest ( string requestPath, string postFilePath, string postFileContentDispositionName, string postFileContentType, string>.Dictionary parameters = null ) : ResponseData
requestPath string Request path.
postFilePath string File system path of file data to be posted.
postFileContentDispositionName string Post file content disposition name.
postFileContentType string Post file content type.
parameters string>.Dictionary Dictionary of form data parameters.
return ResponseData

PutRequest() public method

Perform a PUT request given the uri and put data form fields
public PutRequest ( string requestPath, object>.Dictionary putData ) : ResponseData
requestPath string Request path.
putData object>.Dictionary Put data: dictionary representing JSON data.
return ResponseData

Property Details

_accessTokenRenewer public_oe property

public Timer,System.Threading _accessTokenRenewer
return System.Threading.Timer