public void List_UserGroups_Returns_Data() { var peutils = new PEUtilities(authUrl, appUrl, appID, appKey, integrationSecret); var groups = peutils.ListGroupsForUser("*****@*****.**"); Assert.IsTrue(groups.Count() > 0, "No Groups Returned"); }
/// <summary> /// Creates a PE Identity from a Username - nOt to be called from IAuthenticationExtension2 Methods /// </summary> /// <param name="username">The Username to Create an Identity For</param> /// <returns>ClaimsIdenity with Name and Roles</returns> private ClaimsIdentity CreatePEIdentity(string username) { // Create a Custom Identity var claims = new List <Claim>(); claims.Add(new Claim(ClaimTypes.Name, username)); var peUtils = new PEUtilities(m_oidcAuthority, m_peAppUrl, m_peAppID, m_peAppKey, m_peIntegrationSecret); // add PE Roles var roles = peUtils.ListGroupsForUser(username); claims.AddRange(roles.Select(r => new Claim(ClaimTypes.Role, r))); return(new ClaimsIdentity(claims, "custom", ClaimTypes.Name, ClaimTypes.Role)); }