首页
学习
活动
专区
圈层
工具
发布
    • 综合排序
    • 最热优先
    • 最新优先
    时间不限
  • 来自专栏张善友的专栏

    当调用GetAuthorizationGroups() 的错误-“试图访问卸载的应用程序域“(Exception from HRESULT: 0x80131014)解决方案

    userPrincipal, int tries) { try { return userPrincipal.GetAuthorizationGroups(); } tries > 5) throw; tries++; Thread.Sleep(1000); return GetAuthorizationGroups(userPrincipal tries > 5) throw; tries++; Thread.Sleep(1000); return GetAuthorizationGroups(userPrincipal context = new PrincipalContext(ContextType.Domain, null, _DomainDN)) { try { UserPrincipal p = UserPrincipal.FindByIdentity(context, IdentityType.SamAccountName, username); var tries

    78770发布于 2018-01-30
  • 来自专栏大嘴说编程

    .Net Core系列教程(四)—— 基础身份认证

    new Claim(ClaimTypes.Email,"emailaccount@microsoft.com") }; //var userPrincipal = new ClaimsPrincipal(new ClaimsIdentity(claims, "SuperSecureLogin")); var userPrincipal new ClaimsIdentity(claims, token)); HttpContext.Authentication.SignInAsync("Cookie", userPrincipal new Claim(ClaimTypes.Email,"emailaccount@microsoft.com") }; //var userPrincipal = new ClaimsPrincipal(new ClaimsIdentity(claims, "SuperSecureLogin")); var userPrincipal

    2.7K20发布于 2019-03-21
  • 来自专栏马洪彪

    C#获取AD域中计算机和用户的信息

    1 PrincipalContext principalContext = new PrincipalContext(ContextType.Domain, domainName); 2 UserPrincipal userPrincipal = new UserPrincipal(principalContext); 3 PrincipalSearcher principalSearcher = new PrincipalSearcher (userPrincipal); 查找域中用户及其信息。 1 StringBuilder sb = new StringBuilder(); 2 foreach (UserPrincipal userPrincipalSearchResult in principalSearcher.FindAll )); 9 sb.AppendLine(string.Format("上次登录时间:{0}", userPrincipalSearchResult.LastLogon)); 10 } 11 userPrincipal.Dispose

    3.2K70发布于 2018-04-12
  • 来自专栏码匠的流水账

    聊聊httpclient的disableConnectionState

    { final HttpClientContext clientContext = HttpClientContext.adapt(context); Principal userPrincipal = null) { userPrincipal = getAuthPrincipal(targetAuthState); if (userPrincipal = getAuthPrincipal(proxyAuthState); } } if (userPrincipal == null) { = null) { userPrincipal = sslsession.getLocalPrincipal(); } } } return userPrincipal; } private static Principal getAuthPrincipal(final AuthState

    40430编辑于 2023-11-19
  • 来自专栏全栈程序员必看

    c# 操作ad域用户

    u = new UserPrincipal(context, barcode, passWord, true)) { u.Name = barcode passWord) { using (var context = createConnection()) { UserPrincipal user = UserPrincipal.FindByIdentity(context, userName); if (user ! userName) { using (var context = createConnection()) { UserPrincipal user = UserPrincipal.FindByIdentity(context, userName); if (user !

    1.2K20编辑于 2022-08-29
  • 来自专栏DotNet程序园

    .net core 认证与授权(一)

    Identity"); var CarManagerIdentity = new ClaimsIdentity(LicensClaims, "Licens Identity"); var userPrincipal new ClaimsPrincipal(new[] { SchoolIdentity, CarManagerIdentity }); HttpContext.SignInAsync(userPrincipal var userPrincipal = new ClaimsPrincipal(new[] { SchoolIdentity, CarManagerIdentity }); 我们一生中有身份证,学位证, HttpContext.SignInAsync(userPrincipal); 就会产生证书并且输入到前台。 ? 请看,对这个cooke.name 是不是特别熟悉呢? new ClaimsPrincipal(new[] { SchoolIdentity, CarManagerIdentity }); HttpContext.SignInAsync(userPrincipal

    91410发布于 2020-02-19
  • 来自专栏运维开发王义杰

    Windows:通过PowerShell实现普通用户修改自身密码

    principalContext = New-Object System.DirectoryServices.AccountManagement.PrincipalContext 'Machine' $userPrincipal = [System.DirectoryServices.AccountManagement.UserPrincipal]::FindByIdentity($principalContext, [Environment AsPlainText -Force $newPassword = ConvertTo-SecureString 'Admin_123458' -AsPlainText -Force try { $userPrincipal.ChangePassword 获取用户对象:通过创建PrincipalContext对象和调用UserPrincipal.FindByIdentity方法来定位当前用户。 设置新旧密码:这里我们转换明文密码为安全字符串。

    1.9K10编辑于 2023-08-16
  • 来自专栏编程直播室

    Spring Security判断用户是否已经登录方法一、JSP中检查user principal方法二、检查角色方法三、 还是查询用户方法四、 使用标签库方法五、 使用注解方法六、 编程

    方法一、JSP中检查user principal <c:if test="${pageContext.request.<em>userPrincipal</em>.name ! = null}"> <label> Hi ${pageContext.request.userPrincipal.name} ! Welcome to our site </label> </c:if> <c:choose> <c:when test="${pageContext.request.<em>userPrincipal</em>.authenticated

    4.3K50发布于 2018-06-07
  • 来自专栏飞鸟的专栏

    Spring Boot的安全配置(三)

    HttpServletRequest request, HttpServletResponse response, FilterChain chain, Authentication authResult) { UserPrincipal userPrincipal = (UserPrincipal) authResult.getPrincipal(); String token = Jwts.builder() .setSubject(userPrincipal.getUsername()) .setIssuedAt(new Date()) .setExpiration 在这里,UserPrincipal对象被从Authentication对象中获取,然后使用Jwts类生成JWT令牌。setSubject()方法将用户名设置为JWT主题。

    2.1K41编辑于 2023-04-05
  • 来自专栏花落的技术专栏

    微服务权限

    userPrincipal = new UserPrincipal(findUserList.get(0)); if (! userPrincipal.isEnabled()) { throw new DisabledException(MessageConstant.ACCOUNT_DISABLED); userPrincipal.isAccountNonLocked()) { throw new LockedException(MessageConstant.ACCOUNT_LOCKED) ); } return userPrincipal; } } 5、创建ClientServiceImpl类实现Spring Security的ClientDetailsService userPrincipal = (UserPrincipal) authentication.getPrincipal(); Map<String, Object> info = new HashMap

    1.2K00编辑于 2021-12-07
  • 来自专栏阿林前端开发攻城狮

    C#创建windows系统用户

    try { PrincipalContext context = new PrincipalContext(ContextType.Machine); UserPrincipal user = new UserPrincipal(context); user.SetPassword(password); user.DisplayName = displayName

    1.2K00发布于 2021-11-02
  • 来自专栏技术博客文章

    微服务解决方案

    userPrincipal = new UserPrincipal(findUserList.get(0)); if (! userPrincipal.isEnabled()) { throw new DisabledException(MessageConstant.ACCOUNT_DISABLED); userPrincipal.isAccountNonLocked()) { throw new LockedException(MessageConstant.ACCOUNT_LOCKED) ); } return userPrincipal; } } 5、创建ClientServiceImpl类实现Spring Security的ClientDetailsService userPrincipal = (UserPrincipal) authentication.getPrincipal(); Map<String, Object> info = new HashMap

    1.5K00编辑于 2021-12-17
  • 来自专栏程序猿DD

    Zuul:构建高可用网关之多维度限流

    源码可以参考:https://gitee.com/log4j/pig 用户 限流的实现:如果你的项目整合 Shiro 或者 Spring Security 安全框架,那么会自动维护request域UserPrincipal ,如果是自己的框架,请登录成功后维护request域UserPrincipal,才能使用用户粒度的限流,未登录默认是:anonymous。

    80420发布于 2018-08-17
  • 来自专栏冷冷

    Zuul:构建高可用网关之多维度限流

    动态设置限流开关 源码可以参考:https://gitee.com/log4j/pig 用户限流的实现:如果你的项目整合 Shiro 或者 Spring Security 安全框架,那么会自动维护request域UserPrincipal ,如果是自己的框架,请登录成功后维护request域UserPrincipal,才能使用用户粒度的限流,未登录默认是:anonymous。

    1.9K80发布于 2018-02-08
  • 来自专栏菩提树下的杨过

    Spring Security笔记:使用数据库进行用户认证(form login using database)

    ").submit(); 24 } 25 </script> 26 27 <c:if test="${pageContext.request.<em>userPrincipal</em>.name = null}"> 28

    29 User : ${pageContext.request.userPrincipal.name} | < ("logoutForm").submit(); 16 } 17 </script> 18 19 <c:if test="${pageContext.request.<em>userPrincipal</em>.name = null}"> 20

    21 Welcome : ${pageContext.request.userPrincipal.name} | <a 22

    1.2K10发布于 2018-09-20
  • 来自专栏木宛城主

    SharePoint自动化部署,利用PowerShell 导入用户至AD——PART II

    System.DirectoryServices.AccountManagement.PrincipalContext] $ctx,[string] $userName) { $curUser=[System.DirectoryServices.AccountManagement.UserPrincipal else { $newUser=New-Object -TypeName System.DirectoryServices.AccountManagement.UserPrincipal

    1.9K80发布于 2018-01-11
  • 来自专栏架构专题

    近2万字详解JAVA NIO2文件操作,过瘾!

    ); PosixFileAttributes attributes = Files.readAttributes(path,PosixFileAttributes.class); //用户组和权限 UserPrincipal userPrincipal = attributes.owner(); System.out.println(userPrincipal.toString()); GroupPrincipal groupPrincipal permissions); 修改文件(目录)的所有者或者所在组: Path path = Paths.get("/data/logs/web.log"); //首先找到系统中的其他用户,根据用户名 UserPrincipal userPrincipal = path.getFileSystem().getUserPrincipalLookupService().lookupPrincipalByName("userName "); Files.setOwner(path,userPrincipal); //或者 Files.getFileAttributeView(path,FileOwnerAttributeView.class

    1.1K20发布于 2020-03-17
  • 来自专栏NetCore 从壹开始

    微系列:1、Ocelot 增加自定义Header到下游

    users.WXHeadImg, users.DomainAccount, users.UsersNumber.ToString()); var principalHeader = new UserPrincipal

    98210编辑于 2023-01-09
  • 来自专栏PowerBI入门100例

    5.4 PowerBI技巧-PowerBI权限全览

    静态权限的角色和条件都是死的,适用于角色和人数较少的组织;动态权限是根据用户的USERPRINCIPAL()和手工的用户权限表分配权限,权限维护起来更直观更便于管理。

    1.3K10编辑于 2025-02-26
  • 来自专栏技术、架构与思维

    .net core实践系列之SSO-同域实现

    ), new Claim(JwtClaimTypes.NickName,user.RealName), }; var userPrincipal var returnUrl = HttpContext.Request.Cookies[ReturnUrlKey]; await HttpContext.SignInAsync(userPrincipal

    2K20发布于 2018-10-15
领券