Microsoft.Bot.Connector.MicrosoftAppCredentials Class Reference
Inheritance diagram for Microsoft.Bot.Connector.MicrosoftAppCredentials:

Classes

class  OAuthException
 
class  OAuthResponse
 

Public Member Functions

 MicrosoftAppCredentials (string appId=null, string password=null, ILogger logger=null)
 
 MicrosoftAppCredentials (IConfiguration configuration, ILogger logger=null)
 
async Task< string > GetTokenAsync (bool forceRefresh=false)
 
override async Task ProcessHttpRequestAsync (HttpRequestMessage request, CancellationToken cancellationToken)
 Apply the credentials to the HTTP request. More...
 

Static Public Member Functions

static bool IsTrustedServiceUrl (string serviceUrl)
 Checks if the service url is for a trusted host or not. More...
 
static void TrustServiceUrl (string serviceUrl, DateTime expirationTime=default(DateTime))
 Adds the host of service url to MicrosoftAppCredentials trusted hosts. More...
 

Public Attributes

const string MicrosoftAppIdKey = "MicrosoftAppId"
 The key for Microsoft app Id. More...
 
const string MicrosoftAppPasswordKey = "MicrosoftAppPassword"
 The key for Microsoft app Password. More...
 

Protected Attributes

ILogger logger
 
readonly string TokenCacheKey
 

Static Protected Attributes

static readonly ConcurrentDictionary< string, OAuthResponsecache = new ConcurrentDictionary<string, OAuthResponse>()
 
static ConcurrentDictionary< string, DateTime > TrustedHostNames
 

Properties

string MicrosoftAppId [get, set]
 
string MicrosoftAppPassword [get, set]
 
virtual string OAuthEndpoint [get]
 
virtual string OAuthScope [get]
 

Detailed Description

Definition at line 24 of file MicrosoftAppCredentials.cs.

Constructor & Destructor Documentation

Microsoft.Bot.Connector.MicrosoftAppCredentials.MicrosoftAppCredentials ( string  appId = null,
string  password = null,
ILogger  logger = null 
)
inline

Definition at line 66 of file MicrosoftAppCredentials.cs.

Microsoft.Bot.Connector.MicrosoftAppCredentials.MicrosoftAppCredentials ( IConfiguration  configuration,
ILogger  logger = null 
)
inline

Definition at line 75 of file MicrosoftAppCredentials.cs.

Member Function Documentation

async Task<string> Microsoft.Bot.Connector.MicrosoftAppCredentials.GetTokenAsync ( bool  forceRefresh = false)
inline

Definition at line 149 of file MicrosoftAppCredentials.cs.

static bool Microsoft.Bot.Connector.MicrosoftAppCredentials.IsTrustedServiceUrl ( string  serviceUrl)
inlinestatic

Checks if the service url is for a trusted host or not.

Parameters
serviceUrlThe service url
Returns
True if the host of the service url is trusted; False otherwise.

Definition at line 124 of file MicrosoftAppCredentials.cs.

override async Task Microsoft.Bot.Connector.MicrosoftAppCredentials.ProcessHttpRequestAsync ( HttpRequestMessage  request,
CancellationToken  cancellationToken 
)
inline

Apply the credentials to the HTTP request.

Parameters
requestThe HTTP request.
cancellationTokenCancellation token.

Definition at line 138 of file MicrosoftAppCredentials.cs.

static void Microsoft.Bot.Connector.MicrosoftAppCredentials.TrustServiceUrl ( string  serviceUrl,
DateTime  expirationTime = default(DateTime) 
)
inlinestatic

Adds the host of service url to MicrosoftAppCredentials trusted hosts.

Parameters
serviceUrlThe service url
expirationTimeThe expiration time after which this service url is not trusted anymore

If expiration time is not provided, the expiration time will DateTime.UtcNow.AddDays(1).

Definition at line 97 of file MicrosoftAppCredentials.cs.

Member Data Documentation

readonly ConcurrentDictionary<string, OAuthResponse> Microsoft.Bot.Connector.MicrosoftAppCredentials.cache = new ConcurrentDictionary<string, OAuthResponse>()
staticprotected

Definition at line 41 of file MicrosoftAppCredentials.cs.

ILogger Microsoft.Bot.Connector.MicrosoftAppCredentials.logger
protected

Definition at line 44 of file MicrosoftAppCredentials.cs.

const string Microsoft.Bot.Connector.MicrosoftAppCredentials.MicrosoftAppIdKey = "MicrosoftAppId"

The key for Microsoft app Id.

Definition at line 29 of file MicrosoftAppCredentials.cs.

const string Microsoft.Bot.Connector.MicrosoftAppCredentials.MicrosoftAppPasswordKey = "MicrosoftAppPassword"

The key for Microsoft app Password.

Definition at line 34 of file MicrosoftAppCredentials.cs.

readonly string Microsoft.Bot.Connector.MicrosoftAppCredentials.TokenCacheKey
protected

Definition at line 89 of file MicrosoftAppCredentials.cs.

ConcurrentDictionary<string, DateTime> Microsoft.Bot.Connector.MicrosoftAppCredentials.TrustedHostNames
staticprotected
Initial value:
= new ConcurrentDictionary<string, DateTime>(
new Dictionary<string, DateTime>() {
{ "state.botframework.com", DateTime.MaxValue }
})

Definition at line 36 of file MicrosoftAppCredentials.cs.

Property Documentation

string Microsoft.Bot.Connector.MicrosoftAppCredentials.MicrosoftAppId
getset

Definition at line 83 of file MicrosoftAppCredentials.cs.

string Microsoft.Bot.Connector.MicrosoftAppCredentials.MicrosoftAppPassword
getset

Definition at line 84 of file MicrosoftAppCredentials.cs.

virtual string Microsoft.Bot.Connector.MicrosoftAppCredentials.OAuthEndpoint
get

Definition at line 86 of file MicrosoftAppCredentials.cs.

virtual string Microsoft.Bot.Connector.MicrosoftAppCredentials.OAuthScope
get

Definition at line 87 of file MicrosoftAppCredentials.cs.


The documentation for this class was generated from the following file: