问题标签 [principal]

For questions regarding programming in ECMAScript (JavaScript/JS) and its various dialects/implementations (excluding ActionScript). Note JavaScript is NOT the same as Java! Please include all relevant tags on your question; e.g., [node.js], [jquery], [json], [reactjs], [angular], [ember.js], [vue.js], [typescript], [svelte], etc.

0 投票
1 回答
796 浏览

java - 将 Kerberos 与 Webstart 一起使用。无法从票证缓存中获取 tgt

我在使用带有 Webstart 的 Kerberos 时遇到问题。我想获取当前已登录 Windows 用户的 Principal,并且 API 尝试从票证缓存中获取 tgt。

AllowTgtSessionKey 在注册表中设置为 1。

使用普通的 Java 应用程序一切正常,我得到了票并且可以使用主体。

但是当我将我的应用程序部署为 Webstart 时,我无法从缓存中获取票证并在调用 LoginContext#login 时获得 LoginException。

这是我的代码:

配置:

这是我的代码:

我究竟做错了什么?所有的罐子都签名了!

谢谢你的帮助。

问候,霍尔格

0 投票
0 回答
265 浏览

c# - 使用 DirectoryServices.AccountManagement 按名称从字符串匹配/更新 UserPrincipal 属性

我有一个字典,其键/值是 UserPrincipal 属性。这些是从 csv 文件中读取的。此 csv 文件还具有要更新的相应 AD 用户的employeeId。目标是使用 csv 中提供的值更新 AD 中的每个用户属性。

但是,直到运行时我才知道 csv 中提供了哪些属性。

如何将每个提供的属性名称与正确的 UserPrincipal 属性进行匹配,特别是使用 DirectoryServices.AccountManagement 然后更新 / 保存

我有一种使用 Reflection 和 2.0 的 DirectoryEntry 的方法,可以让我部分地到达那里,但我仍然需要一种更新和保存的方法:

(“userToUpdate”引用了 UserPrincipal 实例,“Attributes”是从 csv 提供的键/值)

0 投票
1 回答
2240 浏览

spring-security - spring-security:校长去哪儿了?

我一直在玩 spring-security 一段时间,由于某种原因,即使身份验证和授权正常工作,我也无法访问 JSP 中的主体。

这是我的 index.jsp:

这是*-security-xml:

当我尝试访问 forAuthenticated.jsp 时,系统会提示我登录。进入 test/test 后,我​​访问了 forAuthenticated 页面,但没有访问 admin/adminUsers.jsp。这没问题,但问题是我无法访问 index.jsp 中的主体。这是以 test/test 登录时 index.jsp 打印的内容。请注意,我看不到not logged innorlogged in痕迹:

我错过了什么?我应该双重检查()什么?

0 投票
2 回答
4477 浏览

c# - 如何访问远程机器以添加/删除/管理用户帐户?

我有一个场景,我需要访问远程机器以编程方式添加和删除 Windows 用户帐户。远程机器是我需要远程配置的“备用工作站”,以防万一需要更换主工作站 - 所以这里没有安全绕过或恶意软件:)

我知道远程机器管理员的用户/密码,并且我能够使用 WMI Win32_UserAccount 检索现有用户帐户的完整列表。现在,我正在尝试为每个用户获取一个 UserPrincipal 对象(最终将其删除),但我的所有尝试都遇到了异常。

  • 尝试#1:

    在这种情况下,我总是在第一行得到一个异常:

    System.DirectoryServices.AccountManagement.PrincipalServerDownException 被捕获 Message=无法联系服务器。
    Source=System.DirectoryServices.AccountManagement StackTrace:在 System.DirectoryServices.AccountManagement.PrincipalContext.ReadServerConfig(String serverName, ServerProperties& properties) 在 System.DirectoryServices.AccountManagement.PrincipalContext.DoServerVerifyAndPropRetrieval() 在 System.DirectoryServices.AccountManagement.PrincipalContext..ctor( System.DirectoryServices.AccountManagement.PrincipalContext..ctor(ContextType contextType, String name, String container, String userName, String password) InnerException: System.DirectoryServices .Protocols.LdapException Message=LDAP 服务器不可用。源 = System.DirectoryServices。

  • 尝试#2:

    在这种情况下,我总是在第二行出现异常:

    System.IO.FileNotFoundException 被捕获 Message=找不到网络路径。

    Source=Active Directory StackTrace:在 System.DirectoryServices.Interop.UnsafeNativeMethods.IAds.GetInfo() 中 System.DirectoryServices.DirectoryEntry.RefreshCache() 在 System.DirectoryServices.AccountManagement.PrincipalContext.DoMachineInit() 在 System.DirectoryServices.AccountManagement.PrincipalContext System.DirectoryServices.AccountManagement.Principal.FindByIdentityWithTypeHelper(PrincipalContext context, Type principalType, Nullable`1 identityType, String identityValue, DateTime refDate) in System.DirectoryServices.AccountManagement 中的 System.DirectoryServices.AccountManagement.PrincipalContext.get_QueryCtx() 中的 .Initialize() System.DirectoryServices 中的 .Principal.FindByIdentityWithType(PrincipalContext context, Type principalType, String identityValue)。AccountManagement.UserPrincipal.FindByIdentity(PrincipalContext context, String identityValue) InnerException:

我尝试了 PrincipalContext 对象的不同签名(使用域名而不是 IP 地址,使用用户名和密码,...),但我总是在两次尝试中都遇到异常。

我错过了一些说明吗?在创建 PrincipalContext 对象之前,我是否需要使用模拟来获得对远程机器的完全访问权限?还有其他方法可以完成我想做的事情吗?(即访问远程机器添加/删除 Windows 帐户)

0 投票
2 回答
2413 浏览

tomcat - 用户主体 不适用于经过身份验证的用户,除非还获得了特定角色的授权

我有一个在 Tomcat 中运行的网络应用程序。我想允许任何具有服务器信任的有效证书的用户访问 Web 应用程序,但我想从证书中读取用户的 DN。我使用 clientAuth="true" 配置了 SSL 连接器(“want”也可以),并且 web.xml 有一个登录约束,需要提供客户端证书。我使用用于签署用户证书的 CA 证书配置了一个信任库。

客户端提供一个证书,服务器接受它,允许访问应用程序。我的问题是,当我在 HttpServletRequest 实例上调用 getUserPrincipal() 时,它为空。如果我在 web.xml 中添加一个 auth-constraint,要求用户处于某个角色,并且用户被配置为处于指定角色,那么用户主体不为空。

HttpServletRequest 的 API 表示如果用户未通过身份验证,则用户主体将为空。我认为用户已通过身份验证,因为他们提供了有效且受信任的证书,但显然在此上下文中的身份验证包括授权?

有什么方法可以从有效的受信任证书访问用户主体,而无需将用户分配给特定角色?

这是导致主体为空的 web.xml 片段:

这是 web.xml 片段,它使我能够在为指定角色配置用户时获取用户主体:

0 投票
1 回答
56 浏览

asp.net-mvc-4 - 在 Stackoverflow 中具有 Profie Principal 的角色

我必须实现会员资格Role Profile

这是什么意思:Role Profile?例如我有一个Manager角色,但我想给他一个特殊的权限,例如读取特殊文档或添加某些数据。或者我有一个Agent他能够担任的角色的成员readonly

我正在使用membership & roles提供商。

你能提出如何实施这种的建议Role Profile or Principal over the Application吗?

0 投票
2 回答
20979 浏览

java - 如何在 Spring MVC REST 通道中获取记录的用户名/主体?

我有 Spring MVC REST 频道:

我有我的方法:

现在我需要登录用户的名称。通常我可以通过方法来完成

但是如何在这里得到它?我有标头 ( @RequestHeader) 甚至 cookie ( @CookieValue) 的注释。但是我怎样才能得到Principal我的方法呢?

0 投票
0 回答
2007 浏览

java - Spring Security 有哪些权威机构?SecurityContextHolder 的身份验证权限与 Principal 的权限

我正在使用 Spring Security 为我的 webapp 提供身份验证和授权。

我使用标准方法UserDetails loadUserByUsername(String username) throws UsernameNotFoundException;使用DaoAuthenticationProvider.

成功登录后,我可以通过两种不同的方式访问用户的权限:

1#SecurityContextHolder.getContext().getAuthentication().getAuthorities()

2#((UserDetails) SecurityContextHolder.getContext().getAuthentication().getPrincipal()).getAuthorities()

它们应该是相同的,因为 Authentication 实例权限列表是从 UserDetails 的 user.getAuthorities() 构造的,但它们实际上是 2 个不同的 Collection 实例。主体的一个是 UnmodifiableSet,Authentication 实例中的一个是 UnmodifiableRandomAccessList。2 个不同的 Collection 实例,它们包含相同的权限列表。

当我试图找到一种解决方案来动态地向当前经过身份验证的委托人添加权限时,这让我感到震惊。这不是一件好事,安全层不应该允许我这样做,但这仍然是我需要的。

我发现可以接受的一个解决方案是使用当前经过身份验证的用户以编程方式登录 new UsernamePasswordAuthenticationToken(authentication.getPrincipal(), authentication.getCredentials(), dbAuthsSet);

authentication是当前的身份验证实例和dbAuthSet当前的权限列表+我需要添加的一个。

这很好用。现在唯一奇怪的是

1#SecurityContextHolder.getContext().getAuthentication().getAuthorities()

2#((UserDetails) SecurityContextHolder.getContext().getAuthentication().getPrincipal()).getAuthorities()

不再返回相同的权限列表。

如果我根据我的应用程序中的身份验证列表检查权限,我很好,这是完全合理的事情。但是如果我检查校长的名单,我就会面临不一致的问题。

你怎么看?这是一个应该在 Spring 的 Security 3.2 中解决的问题吗?

您是否认为以编程方式登录new UsernamePasswordAuthenticationToken()以实现我的目标,即向当前经过身份验证的用户授予会话的额外权限是合理的?

使用 Spring 的Run-As 身份验证替换功能是否是一个好案例?有人可以分享这方面的经验吗?

0 投票
1 回答
340 浏览

components - 主成分分析

我最近正在阅读关于主成分分析的教程(主成分分析教程/Lindsay I Smith)。最后,它讨论了“取回旧数据”。我想知道这样做有什么意义吗?实际上,我已经在 R 中的 princomp 函数下使用名为“USarrests”的数据集进行了尝试。通过转换回旧数据集,我得到的变量数量与原始数据集完全相同,更糟糕的是,转换后的变量是100% 相关。从这个意义上说,PCA 不能减少原始变量的数量,从而消除它们之间的相关性。
谢谢你的建议!

0 投票
1 回答
288 浏览

java - 使用扫描仪的复利

我收到这样的错误:

精度损失

必需:浮动

发现:双

1 个错误