Exemple #1
0
 /// <summary>
 /// Called just before issuing request to service when everything is ready.
 /// Allows to add extra parameters to request or do any other needed preparations.
 /// </summary>
 protected virtual void BeforeGetUserInfo(PasswordBeforeAfterRequestArgs args)
 {
 }
Exemple #2
0
        /// <summary>
        /// Called before the request to get the access token
        /// </summary>
        /// <param name="args"></param>
        protected virtual void BeforeGetAccessToken(PasswordBeforeAfterRequestArgs args)
        {
            args.Request.AddObject(new
            {
                grant_type = GrantType
            });

            if(!Configuration.ClientId.IsEmpty())
            { 
                args.Request.AddObject(new
                {
                    client_id = Configuration.ClientId
                });
            }

            if (!Configuration.ClientSecret.IsEmpty())
            {
                args.Request.AddObject(new
                {
                    client_secret = Configuration.ClientSecret
                });
            }

            if (GrantType == GrantTypeRefreshTokenKey)
            {
                args.Request.AddObject(new
                {
                    refresh_token = args.Parameters.GetOrThrowUnexpectedResponse(RefreshTokenKey),
                });
            }
            else
            {
                args.Request.AddObject(new
                {
                    username = args.Parameters.GetOrThrowUnexpectedResponse(UsernameKey),
                    password = args.Parameters.GetOrThrowUnexpectedResponse(PasswordKey),
                });
            }
        }
Exemple #3
0
 /// <summary>
 /// Called just after obtaining response with access token from service.
 /// Allows to read extra data returned along with access token.
 /// </summary>
 protected virtual void AfterGetAccessToken(PasswordBeforeAfterRequestArgs args)
 {
 }
Exemple #4
0
 /// <summary>
 /// Called just before building the request URI when everything is ready.
 /// Allows to add extra parameters to request or do any other needed preparations.
 /// </summary>
 protected virtual async Task BeforeGetLoginLinkUri(PasswordBeforeAfterRequestArgs args)
 {
     await Task.Factory.StartNew(() => { });
 }