C# 클래스 OpenIdConnect.Client.Common.OpenIdConnectClient

This client will handle the require steps to perform the user's SignIn and SignOut flows. Note that most flows require a Start (redirect to somewhere else) and a Complete invocation, that should be done in the endpoint that is provided in the "redirectUri" parameter.
상속: IOpenIdConnectClient
파일 보기 프로젝트 열기: sapo/sapo-services-sdk 1 사용 예제들

공개 메소드들

메소드 설명
CompleteSignIn ( string code, string state, string redirectUri ) : Task

Completes the SignIn flow. This is the final step in the SignIn flow, that will exchange the authorization code for a access_token. At this point, the client will perform a "backend" request where it will authenticate itself on the token_endpoint, so the access_token can be generated.

GetUserInfo ( AccessTokenResponse accessTokenResponse ) : string>>.Task

Obtains the user's claims, from the userInfo endpoint, given the user's access_token

OpenIdConnectClient ( OpenIdConnectAuthenticationSettings openIdSettings, ISessionStateStore sessionSessionStateStore ) : System

Creates a new OpenIdConnectAuthenticationHandler with the default exchanger (uses HttpClient).

OpenIdConnectClient ( OpenIdConnectAuthenticationSettings openIdSettings, ISessionStateStore sessionSessionStateStore, ICodeForAccessTokenExchanger codeForAccessTokenExchanger ) : System

Creates a new OpenIdConnectAuthenticationHandler.

StartSignIn ( string redirectUri ) : HttpRedirectResponse

Starts the SignIn flow. This will redirect the user to the SDB Connect IdG Endpoint, where the user will perform a series for redirect hops until authenticated. Then, the user will be redirect to redirectUri to complete the SignIn at application level. The steps are: 1. Redirect to SDB Connect IdG to perform the sign in 2. The user performs a series of hops (transparent to the application) to complete the authentication at federation level. 3. Callback to the application sign in redirect URI, where the application receives a "code" (authorization code) 4. The application should then call the CompleteSignIn method to retrieve the access_token from the given "code" The next step should be to exchange the received "code" for an access_token, using the CompleteSignIn method.

StartSignOut ( AccessTokenResponse accessTokenResponse, string redirectUri ) : HttpRedirectResponse

Starts the SignOut flow. You should start this step before cleaning up the user session, because this can be done in the final redirect. The steps are: 1. Redirect to SDB Connect IdG to perform the sign out at federation level 2. Callback to the application sign out redirect URI to cleanup at application level

비공개 메소드들

메소드 설명
GetIdentityGatewayOicSignInEndpoint ( string redirectUri ) : Uri

Build the sign in endpoint URI

GetIdentityGatewayOicSignOutEndpoint ( AccessTokenResponse accessTokenResponse, string redirectUri ) : Uri

Build the sign out endpoint URI

메소드 상세

CompleteSignIn() 공개 메소드

Completes the SignIn flow. This is the final step in the SignIn flow, that will exchange the authorization code for a access_token. At this point, the client will perform a "backend" request where it will authenticate itself on the token_endpoint, so the access_token can be generated.
public CompleteSignIn ( string code, string state, string redirectUri ) : Task
code string The "code" that was provided in the StartSignIn callback.
state string The "state" that was provided in the StartSignIn callback.
redirectUri string The original redirect URI that was provided to the StartSignIn method.
리턴 Task

GetUserInfo() 공개 메소드

Obtains the user's claims, from the userInfo endpoint, given the user's access_token
public GetUserInfo ( AccessTokenResponse accessTokenResponse ) : string>>.Task
accessTokenResponse OpenIdConnect.Client.Common.Representations.AccessTokenResponse /// The token endpoint's access token response (when the user completed the SignIn flow). /// We need the access_token that was returned in this response. ///
리턴 string>>.Task

OpenIdConnectClient() 공개 메소드

Creates a new OpenIdConnectAuthenticationHandler with the default exchanger (uses HttpClient).
public OpenIdConnectClient ( OpenIdConnectAuthenticationSettings openIdSettings, ISessionStateStore sessionSessionStateStore ) : System
openIdSettings OpenIdConnectAuthenticationSettings /// The OpenId client and server settings. /// This includes the client_id and client_secret, as well as the server endpoints. ///
sessionSessionStateStore ISessionStateStore /// A session store that will be used to save the state parameters, for CSRF protection. ///
리턴 System

OpenIdConnectClient() 공개 메소드

Creates a new OpenIdConnectAuthenticationHandler.
public OpenIdConnectClient ( OpenIdConnectAuthenticationSettings openIdSettings, ISessionStateStore sessionSessionStateStore, ICodeForAccessTokenExchanger codeForAccessTokenExchanger ) : System
openIdSettings OpenIdConnectAuthenticationSettings /// The OpenId client and server settings. /// This includes the client_id and client_secret, as well as the server endpoints. ///
sessionSessionStateStore ISessionStateStore /// A session store that will be used to save the state parameters, for CSRF protection. ///
codeForAccessTokenExchanger ICodeForAccessTokenExchanger /// A instance of someone that can exchange authorization codes for access tokens. ///
리턴 System

StartSignIn() 공개 메소드

Starts the SignIn flow. This will redirect the user to the SDB Connect IdG Endpoint, where the user will perform a series for redirect hops until authenticated. Then, the user will be redirect to redirectUri to complete the SignIn at application level. The steps are: 1. Redirect to SDB Connect IdG to perform the sign in 2. The user performs a series of hops (transparent to the application) to complete the authentication at federation level. 3. Callback to the application sign in redirect URI, where the application receives a "code" (authorization code) 4. The application should then call the CompleteSignIn method to retrieve the access_token from the given "code" The next step should be to exchange the received "code" for an access_token, using the CompleteSignIn method.
public StartSignIn ( string redirectUri ) : HttpRedirectResponse
redirectUri string /// The callback URI where the application will call the CompleteSignIn, to exchange the "code" for an "access_token". ///
리턴 OpenIdConnect.Client.Common.Representations.HttpRedirectResponse

StartSignOut() 공개 메소드

Starts the SignOut flow. You should start this step before cleaning up the user session, because this can be done in the final redirect. The steps are: 1. Redirect to SDB Connect IdG to perform the sign out at federation level 2. Callback to the application sign out redirect URI to cleanup at application level
public StartSignOut ( AccessTokenResponse accessTokenResponse, string redirectUri ) : HttpRedirectResponse
accessTokenResponse OpenIdConnect.Client.Common.Representations.AccessTokenResponse /// The token endpoint's access token response (when the user completed the sign in flow). /// We need the id_token that was returned in this response. ///
redirectUri string /// The callback URI where the application will cleanup the user's session ///
리턴 OpenIdConnect.Client.Common.Representations.HttpRedirectResponse