private AuthenticationContext GetAuthenticationContext()

in dotNet/AuthEdge/AuthEdge.cs [83:99]


        private AuthenticationContext GetAuthenticationContext(string tenant, string cacheLocation)
        {
            AuthenticationContext ctx = null;
            if (tenant != null)
                ctx = new AuthenticationContext("https://login.microsoftonline.com/" + tenant, new FileCache(cacheLocation));
            else
            {
                ctx = new AuthenticationContext("https://login.windows.net/common", new FileCache(cacheLocation));
                if (ctx.TokenCache.Count > 0)
                {
                    string homeTenant = ctx.TokenCache.ReadItems().First().TenantId;
                    ctx = new AuthenticationContext("https://login.microsoftonline.com/" + homeTenant, new FileCache(cacheLocation));
                }
            }

            return ctx;
        }