/// <summary> /// Initializes a new instance of the <see cref="BadgeController"/> class. /// </summary> /// <param name="botAdapter">Open badges bot adapter.</param> /// <param name="badgeUserHelper">Instance of badge user helper.</param> /// <param name="logger">Instance to send logs to the Application Insights service.</param> /// <param name="tokenHelper">Generating custom JWT token and retrieving Badgr access token for user.</param> /// <param name="microsoftAppCredentials">App credentials for Bot/ME.</param> /// <param name="superUserSettings">A set of key/value super user configuration for Badges app.</param> /// <param name="keyVaultHelper">Instance of key vault helper to retrieve secrets from Microsoft Azure Key Vault.</param> /// <param name="badgeIssuerHelper">Instance of badge Issuer helper.</param> /// <param name="badgrApiHelper">Helper to handle errors and get user details.</param> /// <param name="badgrUserHelper">Helper to get user details from Badgr.</param> public BadgeController( BotFrameworkAdapter botAdapter, IBadgrUserHelper badgeUserHelper, ILogger <BadgeController> logger, ITokenHelper tokenHelper, MicrosoftAppCredentials microsoftAppCredentials, IOptionsMonitor <SuperUserSettings> superUserSettings, IKeyVaultHelper keyVaultHelper, IBadgrIssuerHelper badgeIssuerHelper, IBadgrApiHelper badgrApiHelper, IBadgrUserHelper badgrUserHelper) { this.badgeUserHelper = badgeUserHelper; this.logger = logger; this.tokenHelper = tokenHelper; this.botAdapter = botAdapter; this.appId = microsoftAppCredentials.MicrosoftAppId; if (superUserSettings == null || superUserSettings.CurrentValue == null) { throw new Exception("Unable to fetch super user settings from configuration file."); } this.superUserSettings = superUserSettings.CurrentValue; this.keyVaultBaseUrl = this.superUserSettings.BaseUrl; this.superUserNameKey = this.superUserSettings.SuperUserNameKey; this.superUserPasswordKey = this.superUserSettings.SuperUserPasswordKey; this.keyVaultHelper = keyVaultHelper; this.badgeIssuerHelper = badgeIssuerHelper; this.badgrApiHelper = badgrApiHelper; this.badgrUserHelper = badgrUserHelper; }
/// <summary> /// Initializes a new instance of the <see cref="BadgeBot"/> class. /// </summary> /// <param name="tokenHelper">Generating custom JWT token and retrieving Badgr access token for user.</param> /// <param name="badgeUserHelper">Instance of badge user helper.</param> /// <param name="optionsAccessor">A set of key/value application configuration properties for Badges bot.</param> /// <param name="badgeApiAppSettings">Represents a set of key/value application configuration properties for Badges bot.</param> /// <param name="oAuthSettings">Represents a set of key/value application configuration properties for OAuth connection.</param> /// <param name="logger">Instance to send logs to the Application Insights service.</param> /// <param name="botAdapter">Open badges bot adapter.</param> /// <param name="badgrIssuerHelper">Helper to get issuer group entity ID.</param> /// <param name="microsoftAppCredentials">Azure Bot channel registered application credentials.</param> public BadgeBot( ITokenHelper tokenHelper, IBadgrUserHelper badgeUserHelper, IOptionsMonitor <BotSettings> optionsAccessor, IOptionsMonitor <BadgeApiAppSettings> badgeApiAppSettings, IOptionsMonitor <OAuthSettings> oAuthSettings, ILogger <BadgeBot> logger, BotFrameworkAdapter botAdapter, IBadgrIssuerHelper badgrIssuerHelper, MicrosoftAppCredentials microsoftAppCredentials) { this.configurationSettings = optionsAccessor.CurrentValue; this.appBaseUrl = this.configurationSettings.AppBaseUri; this.connectionName = oAuthSettings.CurrentValue.ConnectionName; this.appInsightsInstrumentationKey = this.configurationSettings.AppInsightsInstrumentationKey; this.tenantId = this.configurationSettings.TenantId; this.microsoftAppCredentials = microsoftAppCredentials; this.badgeApiAppSettings = badgeApiAppSettings.CurrentValue; this.logger = logger; this.tokenHelper = tokenHelper; this.badgeUserHelper = badgeUserHelper; this.botAdapter = botAdapter; this.badgrIssuerHelper = badgrIssuerHelper; }
/// <summary> /// Initializes a new instance of the <see cref="BadgrUserHelper"/> class. /// </summary> /// <param name="client">Provides a base class for sending HTTP requests and receiving HTTP responses from a resource identified by a URI.</param> /// <param name="logger">Instance to send logs to the Application Insights service.</param> /// <param name="optionsAccessor">A set of key/value application configuration properties for Bagdr rest API.</param> /// <param name="badgrApiHelper">Helper to handle errors and get user details.</param> /// <param name="badgrApiHelper">Helper to handle errors and get list of issuer groups.</param> public BadgrUserHelper(HttpClient client, ILogger <BadgrApiHelper> logger, IOptionsMonitor <BadgeApiAppSettings> optionsAccessor, IBadgrApiHelper badgrApiHelper, IBadgrIssuerHelper badgrIssuerHelper) { this.client = client; this.logger = logger; this.issuerEntityName = optionsAccessor.CurrentValue.IssuerEntityName; this.badgeProviderBaseUrl = optionsAccessor.CurrentValue.BaseUrl; this.badgrApiHelper = badgrApiHelper; this.badgrIssuerHelper = badgrIssuerHelper; }