internal static UserIdentifier From(OriginalUserIdentifier userId)
        {
            var result = new UserIdentifier();

            result.Initialize(userId);
            return(result);
        }
Пример #2
0
        public static async Task testAsync()
        {
            Microsoft.IdentityModel.Clients.ActiveDirectory.ClientCredential cred = new Microsoft.IdentityModel.Clients.ActiveDirectory.ClientCredential(PBIConfig.ClientId, PBIConfig.ClientSecret);
            Microsoft.IdentityModel.Clients.ActiveDirectory.UserIdentifier   user = new Microsoft.IdentityModel.Clients.ActiveDirectory.UserIdentifier("43e514c7-cc35-4226-93a3-eb83a2852ad5", Microsoft.IdentityModel.Clients.ActiveDirectory.UserIdentifierType.OptionalDisplayableId);

            var res = await TokenService.AuthContext.AcquireTokenSilentAsync(PBIConfig.ResourceUrl, cred, user);

            string token = "AQABAAAAAACEfexXxjamQb3OeGQ4Gugv71VOKGNVXNJGkcjBwMuqpryMOp69ZfOaiQ4be_oP3tt2JIQ4U0p5lJpCgdbV5V9eeNseQzaQMxqlPogHyD-FJuH2BCfWEOorBav1Z6Zh6qV7vGYxQmte6oNh-lqV8N1H3cFFqVBbYwQsPsA3RevZ3HJ8phgxf_mRBlx6OsWR-8_LeP8QgDcVUXEbdw93ZCA6v5wX0v8J5Z8yp5YIgvdrPA2LQlSfmhM5u5Vedauue-m0YvtxgZpXwAfyX2NHLP3QRP_5_D224Tv_Au7kOETRbMRBKmrCCQzBbjRC-g3FCWuWyAIYbTJFoqmEcndPGiEWAjny6VYD2lsZTRBbSXAeA0Kqa1loQ8A4QnTAECJBMY0IWppVGzDCvgAO_kT_qwYRqP9fR9YVCeTsF9d4rFMq4Nil-8bc7GDfKcJpa0Z52DxYrIsIYiM9WSuX1Xf0vVpgpY7QFn-YDbuLrlf--bp9wJJ_BHmguHhzWxw6b5rYyqL0IaVlk-1SrmvPy4IoUgslyrF6azQaKLb4EIvkimXC_kmiRVOcFii7wyefO0pikNq3JllpmDQ-FvoqTehNZVvlF4d3dYmISYhzS1xk8ghklb3Br0RrhLj88Yyf47SNFli3YD79nFIxs8v3fybdyxqhp54gCqJN0kf2jkmitX8gR1KH5nwG1pdFDRt9Z3nidIYgAA";
            string url   = "https://api.powerbi.com/v1.0/myorg/admin/groups";

            HttpWebRequest request = (HttpWebRequest)WebRequest.Create(url);

            request.ContentType = "application/json";
            request.MediaType   = "application/json";
            request.Accept      = "application/json";

            request.ContentLength = 0;
            request.Method        = "GET";
            request.Headers.Add("Authorization", String.Format("Bearer {0}", token));

            HttpWebResponse response        = (HttpWebResponse)request.GetResponse();
            string          responseContent = (new StreamReader(response.GetResponseStream())).ReadToEnd();
        }
 private void Initialize(OriginalUserIdentifier userIdentifier)
 {
     _userIdentifier = userIdentifier;
 }
 public UserIdentifier(string id, int type)
 {
     _userIdentifier = new OriginalUserIdentifier(id, UserIdentifierType.IntToEnum(type));
 }