SecureEnvironment.User Property
Definition
Important
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
Gets the user or user-group specified when the SecureEnvironment was created.
public:
property System::Security::RightsManagement::ContentUser ^ User { System::Security::RightsManagement::ContentUser ^ get(); };
public System.Security.RightsManagement.ContentUser User { get; }
member this.User : System.Security.RightsManagement.ContentUser
Public ReadOnly Property User As ContentUser
Property Value
The user or user-group specified to the Create(String, ContentUser) method when the SecureEnvironment was created.
Examples
The following example shows use of the User property
ShowStatus(" Initiating SecureEnvironment as user: \n " +
currentUserId + " [" + _authentication + "]");
if (SecureEnvironment.IsUserActivated(
new ContentUser(currentUserId, _authentication)))
{
ShowStatus(" User is already activated.");
_secureEnv = SecureEnvironment.Create(applicationManifest,
new ContentUser(currentUserId, _authentication));
}
else // if user is not yet activated.
{
ShowStatus(" User is NOT activated,\n activating now....");
// If using the current Windows user, no credentials are
// required and we can use UserActivationMode.Permanent.
_secureEnv = SecureEnvironment.Create(applicationManifest,
_authentication, UserActivationMode.Permanent);
// If not using the current Windows user, use
// UserActivationMode.Temporary to display the Windows
// credentials pop-up window.
///_secureEnv = SecureEnvironment.Create(applicationManifest,
/// a_authentication, UserActivationMode.Temporary);
}
ShowStatus(" Created SecureEnvironment for user:\n " +
_secureEnv.User.Name +
" [" + _secureEnv.User.AuthenticationType + "]");
ShowStatus(" Initiating SecureEnvironment as user: " & vbLf & " " & currentUserId & " [" & _authentication & "]")
If SecureEnvironment.IsUserActivated(New ContentUser(currentUserId, _authentication)) Then
ShowStatus(" User is already activated.")
_secureEnv = SecureEnvironment.Create(applicationManifest, New ContentUser(currentUserId, _authentication))
Else ' if user is not yet activated.
ShowStatus(" User is NOT activated," & vbLf & " activating now....")
' If using the current Windows user, no credentials are
' required and we can use UserActivationMode.Permanent.
_secureEnv = SecureEnvironment.Create(applicationManifest, _authentication, UserActivationMode.Permanent)
' If not using the current Windows user, use
' UserActivationMode.Temporary to display the Windows
' credentials pop-up window.
'''_secureEnv = SecureEnvironment.Create(applicationManifest,
''' a_authentication, UserActivationMode.Temporary)
End If
ShowStatus(" Created SecureEnvironment for user:" & vbLf & " " & _secureEnv.User.Name & " [" & _secureEnv.User.AuthenticationType & "]")
Applies to
See also
GitHub에서 Microsoft와 공동 작업
이 콘텐츠의 원본은 GitHub에서 찾을 수 있으며, 여기서 문제와 끌어오기 요청을 만들고 검토할 수도 있습니다. 자세한 내용은 참여자 가이드를 참조하세요.
.NET