public async Task SetSubscriptionContext(AzureSubscription azureSubscription) { if (BeforeAzureSubscriptionChange != null) { await BeforeAzureSubscriptionChange?.Invoke(this); } _AzureSubscription = azureSubscription; if (_AzureSubscription != null) { if (_TokenProvider != null) { await _TokenProvider.GetToken(_AzureSubscription); } if (_AzureRetriever == null) { _AzureRetriever = new AzureRetriever(this); } await _AzureRetriever.SetSubscriptionContext(_AzureSubscription); } if (AfterAzureSubscriptionChange != null) { await AfterAzureSubscriptionChange?.Invoke(this); } }
public AzureContext(ILogProvider logProvider, IStatusProvider statusProvider, ISettingsProvider settingsProvider) { _LogProvider = logProvider; _StatusProvider = statusProvider; _SettingsProvider = settingsProvider; _TokenProvider = new AzureTokenProvider(_LogProvider); _AzureRetriever = new AzureRetriever(this); }
public AzureContext(AzureRetriever azureRetriever, TargetSettings targetSettings, PromptBehavior defaultPromptBehavior = PromptBehavior.Always) { _AzureRetriever = azureRetriever; _TargetSettings = targetSettings; _LogProvider = azureRetriever.LogProvider; _StatusProvider = azureRetriever.StatusProvider; _LoginPromptBehavior = defaultPromptBehavior; }
public async Task Logout() { if (BeforeUserSignOut != null) { await BeforeUserSignOut.Invoke(); } await this.SetTenantContext(null); _AzureRetriever = null; _TokenProvider.AuthenticationResult = null; if (AfterUserSignOut != null) { await AfterUserSignOut?.Invoke(); } }
//internal void SetAzureContext(AzureContext azureContext) //{ // this.AzureEnvironment = azureContext.AzureEnvironment; // _AzureRetriever = azureContext.AzureRetriever; // _TokenProvider = azureContext.TokenProvider; // if (this.TokenProvider != null) // { // UserAuthenticated?.Invoke(this.TokenProvider.AuthenticationResult.UserInfo); // } //} public async Task Logout() { if (BeforeUserSignOut != null) { await BeforeUserSignOut.Invoke(); } await this.SetSubscriptionContext(null); _AzureRetriever = null; _TokenProvider = null; if (AfterUserSignOut != null) { await AfterUserSignOut?.Invoke(); } }
public async Task Login() { this.TokenProvider = await AzureTokenProvider.LoginAzureProvider(this.AzureEnvironment); this._AzureRetriever = new AzureRetriever(this); }