public async Task <TokenResponse> GetAccessTokenAsync(TokenRequest request)
        {
            IntPtr requestHandle = GetRequestHandle(request as ClientCredentialsTokenRequest);

            return(await Task.Run(() => GetAccessToken(requestHandle)));
        }
 /// <summary>
 /// Access token can be retreived implicitly using <see cref="ClientCredentialsAuthorizer.AuthorizeAsync"/> in this flow.
 /// </summary>
 /// <since_tizen> 3 </since_tizen>
 /// <exception cref="InvalidOperationException">Thrown when the operation is not supported</exception>
 public Task <TokenResponse> GetAccessTokenAsync(TokenRequest request)
 {
     Log.Error(ErrorFactory.LogTag, "Obtain token directly from authorization grant ");
     throw new InvalidOperationException();
 }
Exemplo n.º 3
0
        /// <summary>
        /// Retrieves access token by exchanging authorization code received using <see cref="AuthorizeAsync(AuthorizationRequest)"/>.
        /// The authroization request parameters should be as defined in https://tools.ietf.org/html/rfc6749#section-4.1.3
        /// </summary>
        /// <since_tizen> 3 </since_tizen>
        /// <param name="request">The token request <see cref="CodeGrantTokenRequest"/></param>
        /// <returns>The response containing access token.</returns>
        /// <privilege>http://tizen.org/privilege/internet</privilege>
        /// <exception cref="ArgumentException">Thrown when method failed due to invalid argumets</exception>
        /// <exception cref="OAuth2Exception">Thrown when method fails due to server error</exception>
        public override async Task <TokenResponse> GetAccessTokenAsync(TokenRequest request)
        {
            IntPtr requestHandle = GetRequestHandle(request as CodeGrantTokenRequest);

            return(await Task.Run(() => GetAccessTokenByCode(requestHandle)));
        }
Exemplo n.º 4
0
 /// <summary>
 /// Gets the access token in OAuth2 supported grant flows except Implicit Grant flow.
 /// </summary>
 /// <since_tizen> 3 </since_tizen>
 /// <see cref="CodeGrantAuthorizer.AuthorizeAsync(AuthorizationRequest)"/>
 /// <see cref="ImplicitGrantAuthorizer.AuthorizeAsync(AuthorizationRequest)"/>
 /// <param name="request">A token request</param>
 /// <returns>The response from server</returns>
 public virtual Task <TokenResponse> GetAccessTokenAsync(TokenRequest request)
 {
     throw new NotImplementedException();
 }
Exemplo n.º 5
0
        /// <summary>
        /// Retrieves access token by sending resource owner's password credentials.
        /// The authroization request parameters should be as defined in https://tools.ietf.org/html/rfc6749#section-4.3.2
        /// </summary>
        /// <since_tizen> 3 </since_tizen>
        /// <param name="request">The token request <see cref="ResourceOwnerPwdCredentialsTokenRequest"/></param>
        /// <returns>The response containing access token.</returns>
        /// <privilege>http://tizen.org/privilege/internet</privilege>
        /// <exception cref="ArgumentException">Thrown when method failed due to invalid argumets</exception>
        /// <exception cref="OAuth2Exception">Thrown when method fails due to server error</exception>
        public override async Task <TokenResponse> GetAccessTokenAsync(TokenRequest request)
        {
            IntPtr requestHandle = GetRequestHandle(request as ResourceOwnerPwdCredentialsTokenRequest);

            return(await Task.Run(() => GetAccessToken(requestHandle)));
        }