C# 클래스 OAuth2.Client.OAuth2Client

Base class for any OAuth2 client implementation within this library. Essentially descendants of this class are intended for doing user authentication using certain third-party service.
Standard flow is: - client instance generates URI for login link (__C - hosting app renders page with login link using aforementioned URI - user clicks login link - this leads to redirect to third-party service site - user does authentication and allows app access his/her basic information - third-party service redirects user to hosting app - hosting app reads user information using GetUserInfo method on callback
상속: IClient
파일 보기 프로젝트 열기: carepass/code-samples

공개 메소드들

메소드 설명
GetLoginLinkUri ( string state = null ) : string

Returns URI of service which should be called in order to start authentication process. This URI should be used for rendering login link.

Any additional information that will be posted back by service.

GetUserInfo ( NameValueCollection parameters ) : OAuth2.Models.UserInfo

Obtains user information using OAuth2 service and data provided via callback request.

보호된 메소드들

메소드 설명
AfterGetAccessToken ( IRestResponse response ) : void

Called just after obtaining response with access token from service. Allows to read extra data returned along with access token.

BeforeGetUserInfo ( IRestRequest request ) : void

Called just before issuing request to service when everything is ready. Allows to add extra parameters to request or do any other needed preparations.

OAuth2Client ( IRequestFactory factory, IClientConfiguration configuration ) : System

Initializes a new instance of the OAuth2Client class.

ParseUserInfo ( string content ) : OAuth2.Models.UserInfo

Should return parsed UserInfo using content received from provider.

비공개 메소드들

메소드 설명
GetAccessToken ( NameValueCollection parameters ) : string

Issues query for access token and parses response.

GetUserInfo ( string accessToken ) : OAuth2.Models.UserInfo

Obtains user information using provider API.

메소드 상세

AfterGetAccessToken() 보호된 메소드

Called just after obtaining response with access token from service. Allows to read extra data returned along with access token.
protected AfterGetAccessToken ( IRestResponse response ) : void
response IRestResponse
리턴 void

BeforeGetUserInfo() 보호된 메소드

Called just before issuing request to service when everything is ready. Allows to add extra parameters to request or do any other needed preparations.
protected BeforeGetUserInfo ( IRestRequest request ) : void
request IRestRequest
리턴 void

GetLoginLinkUri() 공개 메소드

Returns URI of service which should be called in order to start authentication process. This URI should be used for rendering login link.
Any additional information that will be posted back by service.
public GetLoginLinkUri ( string state = null ) : string
state string
리턴 string

GetUserInfo() 공개 메소드

Obtains user information using OAuth2 service and data provided via callback request.
public GetUserInfo ( NameValueCollection parameters ) : OAuth2.Models.UserInfo
parameters System.Collections.Specialized.NameValueCollection Callback request payload (parameters).
리턴 OAuth2.Models.UserInfo

OAuth2Client() 보호된 메소드

Initializes a new instance of the OAuth2Client class.
protected OAuth2Client ( IRequestFactory factory, IClientConfiguration configuration ) : System
factory IRequestFactory The factory.
configuration IClientConfiguration The configuration.
리턴 System

ParseUserInfo() 보호된 추상적인 메소드

Should return parsed UserInfo using content received from provider.
protected abstract ParseUserInfo ( string content ) : OAuth2.Models.UserInfo
content string The content which is received from provider.
리턴 OAuth2.Models.UserInfo