private string?GetIdToken() { string?idToken = Context.Request.Headers[AppServicesAuthIdTokenHeader]; #if DEBUG if (string.IsNullOrEmpty(idToken)) { idToken = AppServicesAuthenticationInformation.SimulateGetttingHeaderFromDebugEnvironmentVariable(AppServicesAuthIdTokenHeader); } #endif return(idToken); }
/// <summary> /// Get the IDP from the headers sent by App services authentication. /// </summary> /// <param name="headers">Headers.</param> /// <returns>The IDP.</returns> internal static string?GetIdp(IDictionary <string, StringValues> headers) { if (headers is null) { throw new ArgumentNullException(nameof(headers)); } string?idp = null; if (headers.ContainsKey(AppServicesAuthIdTokenHeader)) { idp = headers[AppServicesAuthIdpTokenHeader]; } #if DEBUG if (string.IsNullOrEmpty(idp)) { idp = AppServicesAuthenticationInformation.SimulateGetttingHeaderFromDebugEnvironmentVariable(AppServicesAuthIdpTokenHeader); } #endif return(idp); }
private string GetAccessToken(IHeaderDictionary?headers) { const string AppServicesAuthAccessTokenHeader = "X-MS-TOKEN-AAD-ACCESS-TOKEN"; string?accessToken = null; if (headers != null) { accessToken = headers[AppServicesAuthAccessTokenHeader]; } #if DEBUG if (string.IsNullOrEmpty(accessToken)) { accessToken = AppServicesAuthenticationInformation.SimulateGetttingHeaderFromDebugEnvironmentVariable(AppServicesAuthAccessTokenHeader); } #endif if (!string.IsNullOrEmpty(accessToken)) { return(accessToken); } return(string.Empty); }