protected override ClaimsIdentity GetOutputClaimsIdentity( ClaimsPrincipal principal, RequestSecurityToken request, Scope scope ) { ClaimsIdentity outgoingIdentity = new ClaimsIdentity(); outgoingIdentity.AddClaims(principal.Claims); List<Role> roles = (List<Role>)HttpContext.Current.Session["User_Roles_" + principal.Identity.Name]; RBACHelper rbacHelper = new RBACHelper(); Permission[] permissions = rbacHelper.GetUserPermissions(Factory.Session(Factory.User(principal.Identity.Name), roles.ToArray())); outgoingIdentity.AddClaim(new Claim("http://schemas.xmlsoap.org/ws/2005/05/identity/claims/permissions", Serialize(permissions))); return outgoingIdentity; }
protected void UserloginWizard_ActiveStepChanged(object sender, EventArgs e) { Wizard wizard = (Wizard)sender; if (wizard != null && wizard.ActiveStepIndex == 1) { RBACHelper helper = new RBACHelper(); List<RBAC.Core.Entities.Role> roles = helper.GetUserRolesHierarchy(Factory.User(STSLogin.UserName).Id); CheckBoxList rolesList = (CheckBoxList)wizard.ActiveStep.FindControl("RolesList"); foreach (RBAC.Core.Entities.Role role in roles) { rolesList.Items.Add(new ListItem(role.Name)); } } }
public PermissionAccessAttribute(params String[] permissions) { this.helper = new RBACHelper(); this.permissions = permissions; }