@@ -26,7 +26,11 @@ namespace IBM.Cloud.SDK
26
26
{
27
27
public class BaseService
28
28
{
29
- protected Authenticator authenticator ;
29
+ #region Authenticator
30
+ /// <summary>
31
+ /// Gets and sets the authenticator of the service.
32
+ public Authenticator Authenticator { get ; set ; }
33
+ #endregion
30
34
protected string serviceUrl ;
31
35
public string ServiceId { get ; set ; }
32
36
protected Dictionary < string , string > customRequestHeaders = new Dictionary < string , string > ( ) ;
@@ -39,8 +43,7 @@ public BaseService(string versionDate, Authenticator authenticator, string servi
39
43
public BaseService ( Authenticator authenticator , string serviceId ) {
40
44
ServiceId = serviceId ;
41
45
42
- this . authenticator = authenticator ?? throw new ArgumentNullException ( ErrorMessageNoAuthenticator ) ;
43
-
46
+ Authenticator = authenticator ?? throw new ArgumentNullException ( ErrorMessageNoAuthenticator ) ;
44
47
// Try to retrieve the service URL from either a credential file, environment, or VCAP_SERVICES.
45
48
Dictionary < string , string > props = CredentialUtils . GetServiceProperties ( serviceId ) ;
46
49
props . TryGetValue ( PropNameServiceUrl , out string url ) ;
@@ -50,18 +53,6 @@ public BaseService(Authenticator authenticator, string serviceId) {
50
53
}
51
54
}
52
55
53
- protected void SetAuthentication ( RESTConnector connector )
54
- {
55
- if ( authenticator != null )
56
- {
57
- authenticator . Authenticate ( connector ) ;
58
- }
59
- else
60
- {
61
- throw new ArgumentException ( "Authentication information was not properly configured." ) ;
62
- }
63
- }
64
-
65
56
public void SetServiceUrl ( string url )
66
57
{
67
58
serviceUrl = url ;
@@ -72,7 +63,7 @@ public void SetServiceUrl(string url)
72
63
/// </summary>
73
64
public Authenticator GetAuthenticator ( )
74
65
{
75
- return authenticator ;
66
+ return Authenticator ;
76
67
}
77
68
78
69
public void WithHeader ( string name , string value )
0 commit comments