标签: principal

什么是*连续物理模拟的基本思想*如box2d/bullet3d?

游戏或图形行业中的传统物理模拟基本上是离散的.但是现在的引擎如box2d或bullet3d实现了连续物理模拟.我知道离散模拟的基本原理,但我不知道连续模拟.这对我来说是神奇的,使用魔法是艰难而危险的.因此,我希望通过理解它们将魔法变成工具.

所以我想知道:(1)这些连续物理模拟的基本思想和实现原理是什么?(2)这个想法可以推广到其他类型的离散模拟吗?请让我理解这一点!

simulation continuous principal physics-engine

7
推荐指数
1
解决办法
1332
查看次数

如何使用System.DirectoryServices.AccountManagement命名空间获取Active Directory用户属性?

我想从用户获取Active Directory属性,我想使用System.DirectoryServices.AccountManagement.

我的代码:

public static void GetUserProperties(string dc,string user) 
        {
            PrincipalContext ctx = new PrincipalContext(ContextType.Domain, dc);
            UserPrincipal u = UserPrincipal.FindByIdentity(ctx, user);

            string firstname = u.GivenName;
            string lastname = u.Surname;
            string email = u.EmailAddress;
            string telephone = u.VoiceTelephoneNumber;

            ...//how I can get company and other properties?
        }
Run Code Online (Sandbox Code Playgroud)

c# properties active-directory principal userprincipal

7
推荐指数
1
解决办法
2万
查看次数

从IAuthorizationPolicy设置Thread.CurrentPrincipal?

我有一个在.NET Framework 4.6.2下运行的WCF服务.我之前使用过web.config来使用我的自定义IAuthorizationPolicy配置服务,如下所示:

<services>
behaviorConfiguration="MyClientService.CustomValidator_Behavior" name="My.Service.Implementation.Services.MyClientService">
        <endpoint binding="netHttpBinding" behaviorConfiguration="protoEndpointBehavior" address="BinaryHttpProto" bindingNamespace="http://My.ServiceContracts/2007/11" contract="My.ServiceContracts.IMyClientService" />
        <endpoint binding="netHttpsBinding" behaviorConfiguration="protoEndpointBehavior" address="BinaryHttpsProto" bindingNamespace="http://My.ServiceContracts/2007/11" contract="My.ServiceContracts.IMyClientService" />
        bindingConfiguration="netTcpCertificate" behaviorConfiguration="protoEndpointBehavior" bindingNamespace="http://My.ServiceContracts/2007/11" contract="My.ServiceContracts.IMyClientService" address="Sll"/>
        <host>
        </host>
      </service>
    </services>


    <behavior name="MyClientService.CustomValidator_Behavior">
      <dataContractSerializer maxItemsInObjectGraph="2147483647" />
      <serviceDebug includeExceptionDetailInFaults="true" />
      <serviceMetadata httpGetEnabled="true" />
      <customBehaviorExtension_ClientService />
      <serviceThrottling maxConcurrentCalls="2000" maxConcurrentSessions="2147483647" maxConcurrentInstances="2000" />
      <serviceCredentials>
        <clientCertificate>
          <authentication certificateValidationMode="PeerOrChainTrust" />
        </clientCertificate>
        <userNameAuthentication userNamePasswordValidationMode="Custom" customUserNamePasswordValidatorType="My.Service.Implementation.Security.CustomUsernamePasswordValidator, My.Service.Implementation" />
      </serviceCredentials>
      <serviceAuthorization principalPermissionMode="Custom" serviceAuthorizationManagerType="My.Service.Implementation.Security.CustomServiceAuthorizationManager, My.Service.Implementation">
        <authorizationPolicies>
          <add policyType="My.Service.Implementation.Security.CustomAuthorizationPolicy_ClientService, My.Service.Implementation" />
        </authorizationPolicies>
      </serviceAuthorization>
    </behavior>
Run Code Online (Sandbox Code Playgroud)

现在我需要在代码中进行切换,这就是:

var endpoint = new System.ServiceModel.Description.ServiceEndpoint(System.ServiceModel.Description.ContractDescription.GetContract(typeof(IMyClientService)),
                        binding,
                       new …
Run Code Online (Sandbox Code Playgroud)

c# wcf principal

7
推荐指数
1
解决办法
387
查看次数

WCF RESTful服务的基于声明的身份验证

我一直在研究各种样本,试图为ASP.Net Web服务和WCF RESTful Web服务拼凑基于SAML令牌的身份验证解决方案......我参考过的一些示例:

我一直在与每个障碍作斗争,我很亲密,我可以品尝它.给我的最新一块是:

如果我用的是普通WebServiceHostFactory,定制的授权策略被应用,并且结束Thread.CurrentPrincipal中最多的,取值为我的HTTP模块集HttpContext.Current.User ...但是...如果我使用WebServiceHost2Factory(即从REST入门工具包),以获得自动求助终点,等等,然后将已授权政策没有应用,并且Thread.CurrentPrincipal中最终被以任何方式有关ClaimsPrincipal我在设置RoleProviderPrincipal的实例的HttpModule ..: - (

有任何想法,想法如何让WebServiceHost2Factory与自定义/重写主体发挥良好作用?

谢谢,

泰勒

rest wcf saml principal

6
推荐指数
1
解决办法
2897
查看次数

Spring 3 MVC Controller集成测试 - 将Principal注入方法

作为Spring 3 MVC的一部分,可以将当前登录的用户(Principle)对象注入控制器方法.

例如

@Controller
public class MyController {

    @RequestMapping(value="/update", method = RequestMethod.POST)
    public String update(ModelMap model, Principal principal) {

       String name = principal.getName();
       ... the rest here
    }
}
Run Code Online (Sandbox Code Playgroud)

这是作为Spring 3文档的一部分记录的:http: //static.springsource.org/spring/docs/3.0.x/spring-framework-reference/html/mvc.html#mvc-ann-requestmapping-arguments.

这适用于生产代码.但是我不知道如何测试这个.当我创建集成测试(也设置了spring安全上下文)并调用控制器句柄方法时,Principal始终为null!

public class FareTypeControllerIntegrationTest extends SpringTestBase {

@Autowired
private MyController controller;

@Autowired
private AnnotationMethodHandlerAdapter handlerAdapter;

private final MockHttpServletRequest request = new MockHttpServletRequest();
private final MockHttpServletResponse response = new MockHttpServletResponse();

@Test
public void testUpdate() throws Exception {
    request.setRequestURI("/update");
    request.setMethod(HttpMethod.POST.name());
    ... setup rest of request

    ModelAndView …
Run Code Online (Sandbox Code Playgroud)

model-view-controller integration spring controller principal

6
推荐指数
1
解决办法
5772
查看次数

如何理解SQL Server中的Principal?

这听起来很愚蠢,但我发现它确实令人困惑:在MSDN中,定义是可以请求SQL Server资源的实体.基本上有三种类型的主体:Windows级主体,SQL Server级主体和数据库级主体.到目前为止一切都很好.只是它给我的印象是一个主体的标识符应该与其他主体不同,无论这个原则是什么类型.(如果这三种类型的所有主体都可以安排在一个表中,它们将具有唯一标识符)

令人困惑的部分来自以下三个问题:

1)

Select name,principal_id from sys.database_principals 
Run Code Online (Sandbox Code Playgroud)

(注意:我在一个数据库上运行它)

2)

Select name,principal_id from sys.server_principals
Run Code Online (Sandbox Code Playgroud)

现在我知道第一个返回数据库用户主体,而第二个返回服务器用户主体(如果我错了,请纠正我).但是为什么第一个查询中的一行可以与第二个查询中的一行具有相同的principal_id?例如,数据库主体中的一行将是:

名称:INFORMATION_SCHEMA,principal_id:3

而第二个查询中的一行是

name:sysadmin,principal_id:3

这两个principal_id是什么?正如我所提到的,我认为两个主体的标识符会有所不同,即使一个是DB用户而另一个是服务器用户(并且从名称我假设principal_id是标识符).

好吧,如果principal_id对于所有主体都不是唯一的,但在每个查询的范围内只是唯一的(第一个查询中的principal_id只是数据库用户的标识符,所以它可能恰好与服务器用户的相同),然后我有第三个查询,不明白它是什么意思:

3)

SELECT
  SDP.PRINCIPAL_ID AS [Principal ID], 
  SDP.NAME AS [Database UserName], 
  SDP.TYPE_DESC AS [Datebase UserType],  
  SSP.NAME AS [Server LoginName], 
  SSP.TYPE_DESC AS [Server LoginType]
FROM sys.database_principals SDP 
INNER JOIN sys.server_principals SSP 
ON SDP.PRINCIPAL_ID = SSP.PRINCIPAL_ID
Run Code Online (Sandbox Code Playgroud)

如果两个principal_id在其范围内仅是唯一的,那么在两个principal_id上进行内连接意味着什么?内连接意味着此列是共同唯一的,对吧?

必须有一些我误解的非常基本的东西.感谢您的帮助!

sql-server database-permissions principal

6
推荐指数
1
解决办法
1万
查看次数

如何使用Spring安全性和spring安全对象的属性限制对URL的访问?

我正在使用Spring 5.1和Spring security 4.2.我使用XML文件配置了访问规则.我的问题是,如何根据Spring安全上下文中的属性编写拦截规则(对URL的访问控制)?也就是说,我有一个变量

productList
Run Code Online (Sandbox Code Playgroud)

在安全上下文中,类型为java.util.ArrayList.如果此列表为空或null,我想限制对URL的访问.我怎么写这个?我有

<http name="defaultSecurity" security-context-repository-ref="myContextRepository"
    auto-config="false" use-expressions="true" authentication-manager-ref="authenticationManager"
    entry-point-ref="loginUrlAuthenticationEntryPoint">
    ...
    <intercept-url pattern="/myurl" access="length(principal.productList) > 0" />
    ...
</http>
Run Code Online (Sandbox Code Playgroud)

但当然,上面

length(principal.productList) > 0   
Run Code Online (Sandbox Code Playgroud)

表达是完全错误的.有没有正确的方法来写它?

spring access-control spring-security security-context principal

6
推荐指数
1
解决办法
652
查看次数

如何设置Thread.CurrentPrincipal以在整个应用程序中使用?

在ASP.net应用程序中,我正在使用我编写的自定义成员资格提供程序的Login控件.我想要做的是Thread.CurrentPrincipal在用户通过身份验证后设置为我的自定义Principal对象.

我正在使用setter:Thread.CurrentPrincipal它为我设置了Principal对象,但是在所有后续线程上,这个CurrentPrincipal被默认值覆盖.

这是我的Login控件的Authenticate事件的代码:

protected void Login1_Authenticate(object sender, AuthenticateEventArgs e)
    {
        string username = Login1.UserName;
        string password = Login1.Password;

        if (Membership.ValidateUser(username, password))
        {
            var login = sender as Login;
            var phoenixIdentity = new PhoenixIdentity("B", "Forms" , true);
            var principal = new PhoenixPrincipal(phoenixIdentity);

            Thread.CurrentPrincipal = principal;
            AppDomain.CurrentDomain.SetThreadPrincipal(principal);

            HttpContext.Current.User = principal;

            e.Authenticated = true;
        }
    }
Run Code Online (Sandbox Code Playgroud)

例如,假设我使用用户名A登录,一切顺利......验证通过,但我使用Identity对象中的用户名B对用户进行硬编码,该对象设置为我设置为CurrentPrincipal对象的Principal 对象.

当我CurrentPrincipal在此方法结束时检查哪个用户设置为Identity时,它表示它是用户B.但是当我加载另一个页面然后检查其身份CurrentPrincipal是什么时,它表示它是用户A.

那么,如何让我的CurrentPrincipal对象在所有其他线程中保持持久性,以及此Login控件何时/何时设置CurrentPrincipalThread 的对象?

asp.net authentication identity principal

5
推荐指数
1
解决办法
1万
查看次数

在 apache shiro 上为主题添加信息

我正在使用 apache shiro。当我想知道用户是否有权限和角色时,我使用 SecutiryUtils.getSubject()。我想知道如何向主题添加更多信息,例如电子邮件、主键和我需要的任何其他业务信息,以便在必要时检索该信息。

这是我的 shiro.ini:

[main]
ds = org.apache.shiro.jndi.JndiObjectFactory   
ds.requiredType = javax.sql.DataSource  
ds.resourceName = java:/comp/env/jdbc/myDS

# JDBC realm config  
jdbcRealm = com.mycompany.JdbcRealmImpl
jdbcRealm.permissionsLookupEnabled = true 
jdbcRealm.authenticationQuery = SELECT password FROM user WHERE username = ? AND status = 1
jdbcRealm.dataSource = $ds

sha256Matcher = org.apache.shiro.authc.credential.Sha256CredentialsMatcher
jdbcRealm.credentialsMatcher = $sha256Matcher

[urls]
/logout = logout
/** = authcBasic
Run Code Online (Sandbox Code Playgroud)

这是我的 JdbcRealm

public class JdbcRealmImpl extends JdbcRealm {

    public JdbcRealmImpl() {
        super();
    }

    @Override
    protected AuthenticationInfo doGetAuthenticationInfo(
            final AuthenticationToken token) throws AuthenticationException {

        final …
Run Code Online (Sandbox Code Playgroud)

subject principal shiro

5
推荐指数
1
解决办法
1995
查看次数

读取 azure blob 时使用 Service Principal

我遵循了教程(在 * 下方),现在有了一个 Service Principal 。使用 Get-AzureStorageBlob 读取 blob 时如何使用此服务主体?Get-AzureStorageBlob 需要一个 New-AzureStorageContext ,我可以使用 SP 而不是 StorageAccountKey guid 吗?谢谢,彼得

service blob azure principal

5
推荐指数
1
解决办法
4325
查看次数