File tree Expand file tree Collapse file tree 2 files changed +20
-0
lines changed
src/IOLApiClient.Auth.Repository/Repositories Expand file tree Collapse file tree 2 files changed +20
-0
lines changed Original file line number Diff line number Diff line change @@ -44,10 +44,22 @@ ILogger logger
44
44
_logger = logger ;
45
45
}
46
46
47
+ /// <summary>
48
+ /// Login method to obtain token data that will be store in IBearerTokenDataProvider
49
+ /// </summary>
47
50
public async Task Login ( )
48
51
{
49
52
_logger . Information ( $ "{ _classLogMessageDiagnose } { _methodLoginMessageDiagnose } , Initializing login...") ;
50
53
54
+ if ( string . IsNullOrEmpty ( _loginRepositorySettings . UserNameIOLClient ) )
55
+ throw new InvalidOperationException ( $ "{ nameof ( ILoginRepositorySettings . UserNameIOLClient ) } is null or empty, can't login.") ;
56
+
57
+ if ( string . IsNullOrEmpty ( _loginRepositorySettings . PasswordIOLClient ) )
58
+ throw new InvalidOperationException ( $ "{ nameof ( ILoginRepositorySettings . PasswordIOLClient ) } is null or empty, can't login.") ;
59
+
60
+ if ( string . IsNullOrEmpty ( _loginRepositorySettings . BaseUrl ) )
61
+ throw new InvalidOperationException ( $ "{ nameof ( ILoginRepositorySettings . BaseUrl ) } is null or empty, can't login.") ;
62
+
51
63
using ( var client = new HttpClient ( ) )
52
64
{
53
65
BuildDefaultHeaders ( client ) ;
Original file line number Diff line number Diff line change @@ -40,8 +40,16 @@ ILogger logger
40
40
_logger = logger ;
41
41
}
42
42
43
+ /// <summary>
44
+ /// RefreshToken method that will refresh token data stored in IBearerTokenDataProvider
45
+ /// </summary>
43
46
public async Task RefreshToken ( )
44
47
{
48
+ _logger . Information ( $ "{ _classRefreshTokenMessageDiagnose } { _methodRefreshTokenMessageDiagnose } , Initializing refresh token...") ;
49
+
50
+ if ( string . IsNullOrEmpty ( _bearerTokenData . LoginResponseModel . RefreshToken ) )
51
+ throw new InvalidOperationException ( $ "{ nameof ( IBearerTokenDataProvider . LoginResponseModel . RefreshToken ) } is null or empty, can't refresh token.") ;
52
+
45
53
using ( var client = new HttpClient ( ) )
46
54
{
47
55
BuildDefaultHeaders ( client ) ;
You can’t perform that action at this time.
0 commit comments