访问.NET线程以获取Principal / Identity? [英] access .NET thread to get Principal / Identity ?

查看:53
本文介绍了访问.NET线程以获取Principal / Identity?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

可以从C ++应用程序获得吗?

谢谢。 -Greg

is that possible from a C++ app?
thank you. -Greg

推荐答案

" hazz" <公顷** @ sonic.net>在消息中写道

新闻:Ob ************** @ TK2MSFTNGP12.phx.gbl ...
"hazz" <ha**@sonic.net> wrote in message
news:Ob**************@TK2MSFTNGP12.phx.gbl...
是可能的C ++应用程序?
谢谢。
is that possible from a C++ app?
thank you.




不清楚你想做什么。你在说哪个帖子

关于?


C ++的两种方言(托管和非托管)都可以毫无困难地调用

函数Win32 API。特别是,调用GetUserName()和

LookupAccountName()可能会带你到你想去的地方。


问候,




It is not all that clear what you want to do. Which thread are you talking
about?

Both dialects of C++ (managed and unmanaged) have no trouble calling
functions of the Win32 API. In particular, calling GetUserName() and
LookupAccountName() might take you where you want to go.

Regards,
Will


感谢您回复Will。很抱歉没有提供更多详细信息。


我使用.NET System.Security.Principal获得以下.NET C#代码;


m_iIdnt = new System.Security.Principal.GenericIdentity(t.UserNa me,custom

authentication);

m_iPrincipal = new

系统。 Security.Principal.GenericPrincipal(m_iIdnt,roles);

System.Threading.Thread.CurrentPrincipal = m_iPrinci pal;


我想做的是访问来自上面发生的事情的身份,但是来自C ++应用程序而不是以下.NET应用程序的
;


IPrincipal currentPrincipal = Thread.CurrentPrincipal;

IIdentity currentIdentity = currentPrincipal.Identity;

string authtype = currentIdentity.AuthenticationType;

if(currentIdentity.IsAuthenticated).........


谢谢你,

Greg


" William DePalo [MVP VC ++]" < WI *********** @ mvps.org>在消息中写道

新闻:哦************** @ TK2MSFTNGP11.phx.gbl ...
Thank you for responding Will. Sorry for not offering more detail.

I have the following .NET C# code using .NET System.Security.Principal;

m_iIdnt = new System.Security.Principal.GenericIdentity(t.UserNa me,"custom
authentication");
m_iPrincipal = new
System.Security.Principal.GenericPrincipal(m_iIdnt ,roles);
System.Threading.Thread.CurrentPrincipal=m_iPrinci pal;

What I would like to do is access the Identity from what happened above, but
from a C++ app rather than the following .NET app;

IPrincipal currentPrincipal = Thread.CurrentPrincipal;
IIdentity currentIdentity = currentPrincipal.Identity;
string authtype = currentIdentity.AuthenticationType;
if (currentIdentity.IsAuthenticated) .........

thank you,
Greg

"William DePalo [MVP VC++]" <wi***********@mvps.org> wrote in message
news:Oh**************@TK2MSFTNGP11.phx.gbl...
" hazz" <公顷** @ sonic.net>在消息中写道
新闻:Ob ************** @ TK2MSFTNGP12.phx.gbl ...
"hazz" <ha**@sonic.net> wrote in message
news:Ob**************@TK2MSFTNGP12.phx.gbl...
是否可以从C ++应用程序中获取?<谢谢。
is that possible from a C++ app?
thank you.



不清楚你想做什么。您正在谈论哪个主题?

C ++(托管和非托管)的两种方言都可以轻松调用Win32 API的功能。特别是,调用GetUserName()和
LookupAccountName()可能会带你到你想去的地方。

问候,



It is not all that clear what you want to do. Which thread are you talking
about?

Both dialects of C++ (managed and unmanaged) have no trouble calling
functions of the Win32 API. In particular, calling GetUserName() and
LookupAccountName() might take you where you want to go.

Regards,
Will


FCL类只能在托管C ++应用程序中使用,本机C ++

不能使用托管类。


威利。


" hazz" <公顷** @ sonic.net>在消息中写道

新闻:OD ************** @ TK2MSFTNGP12.phx.gbl ...
The FCL classes are only usable in a managed C++ application, native C++
cannot use managed classes.

Willy.

"hazz" <ha**@sonic.net> wrote in message
news:OD**************@TK2MSFTNGP12.phx.gbl...
感谢您回复Will 。很抱歉没有提供更多详细信息。

我使用.NET System.Security.Principal有以下.NET C#代码;

m_iIdnt = new
System.Security .Principal.GenericIdentity(t.UserNa me,custom
authentication");
m_iPrincipal = new
System.Security.Principal.GenericPrincipal(m_iIdnt,roles);
System .Threading.Thread.CurrentPrincipal = m_iPrinci pal;

我想做的是从上面发生的事情中访问身份,
但是来自C ++应用程序而不是以下内容.NET app;

IPrincipal currentPrincipal = Thread.CurrentPrincipal;
IIdentity currentIdentity = currentPrincipal.Identity;
string authtype = currentIdentity.AuthenticationType;
if(currentIdentity.IsAuthenticated) ).........

谢谢,
Greg

William DePalo [MVP VC ++]" < WI *********** @ mvps.org>在消息中写道
新闻:哦************** @ TK2MSFTNGP11.phx.gbl ...
Thank you for responding Will. Sorry for not offering more detail.

I have the following .NET C# code using .NET System.Security.Principal;

m_iIdnt = new
System.Security.Principal.GenericIdentity(t.UserNa me,"custom
authentication");
m_iPrincipal = new
System.Security.Principal.GenericPrincipal(m_iIdnt ,roles);
System.Threading.Thread.CurrentPrincipal=m_iPrinci pal;

What I would like to do is access the Identity from what happened above,
but
from a C++ app rather than the following .NET app;

IPrincipal currentPrincipal = Thread.CurrentPrincipal;
IIdentity currentIdentity = currentPrincipal.Identity;
string authtype = currentIdentity.AuthenticationType;
if (currentIdentity.IsAuthenticated) .........

thank you,
Greg

"William DePalo [MVP VC++]" <wi***********@mvps.org> wrote in message
news:Oh**************@TK2MSFTNGP11.phx.gbl...
" hazz" <公顷** @ sonic.net>在消息中写道
新闻:Ob ************** @ TK2MSFTNGP12.phx.gbl ...
"hazz" <ha**@sonic.net> wrote in message
news:Ob**************@TK2MSFTNGP12.phx.gbl...
>这可能来自C ++应用程序吗?
>谢谢。
> is that possible from a C++ app?
> thank you.



并不是很清楚你想做什么。您正在讨论哪个主题?

C ++的两种方言(托管和非托管)都可以轻松调用Win32 API的功能。特别是,调用GetUserName()和
LookupAccountName()可能会带你到你想去的地方。

问候,



It is not all that clear what you want to do. Which thread are you
talking
about?

Both dialects of C++ (managed and unmanaged) have no trouble calling
functions of the Win32 API. In particular, calling GetUserName() and
LookupAccountName() might take you where you want to go.

Regards,
Will



这篇关于访问.NET线程以获取Principal / Identity?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆