Files
Dec2017-Script-Dump/mscorlib/System/Security/Permissions/PrincipalPermissionAttribute.cs
T
2026-06-04 11:42:34 +02:00

100 lines
3.4 KiB
C#

using System;
using System.Runtime.InteropServices;
namespace System.Security.Permissions
{
/// <summary>Allows security actions for <see cref="T:System.Security.Permissions.PrincipalPermission" /> to be applied to code using declarative security. This class cannot be inherited.</summary>
// Token: 0x0200055E RID: 1374
[ComVisible(true)]
[AttributeUsage(AttributeTargets.Class | AttributeTargets.Method, AllowMultiple = true, Inherited = false)]
[Serializable]
public sealed class PrincipalPermissionAttribute : CodeAccessSecurityAttribute
{
/// <summary>Initializes a new instance of the <see cref="T:System.Security.Permissions.PrincipalPermissionAttribute" /> class with the specified <see cref="T:System.Security.Permissions.SecurityAction" />.</summary>
/// <param name="action">One of the <see cref="T:System.Security.Permissions.SecurityAction" /> values. </param>
// Token: 0x0600322F RID: 12847 RVA: 0x000AC77C File Offset: 0x000AA97C
public PrincipalPermissionAttribute(SecurityAction action)
: base(action)
{
this.authenticated = true;
}
/// <summary>Gets or sets a value indicating whether the current principal has been authenticated by the underlying role-based security provider.</summary>
/// <returns>true if the current principal has been authenticated; otherwise, false.</returns>
// Token: 0x170009DA RID: 2522
// (get) Token: 0x06003230 RID: 12848 RVA: 0x000AC78C File Offset: 0x000AA98C
// (set) Token: 0x06003231 RID: 12849 RVA: 0x000AC794 File Offset: 0x000AA994
public bool Authenticated
{
get
{
return this.authenticated;
}
set
{
this.authenticated = value;
}
}
/// <summary>Gets or sets the name of the identity associated with the current principal.</summary>
/// <returns>A name to match against that provided by the underlying role-based security provider.</returns>
// Token: 0x170009DB RID: 2523
// (get) Token: 0x06003232 RID: 12850 RVA: 0x000AC7A0 File Offset: 0x000AA9A0
// (set) Token: 0x06003233 RID: 12851 RVA: 0x000AC7A8 File Offset: 0x000AA9A8
public string Name
{
get
{
return this.name;
}
set
{
this.name = value;
}
}
/// <summary>Gets or sets membership in a specified security role.</summary>
/// <returns>The name of a role from the underlying role-based security provider.</returns>
// Token: 0x170009DC RID: 2524
// (get) Token: 0x06003234 RID: 12852 RVA: 0x000AC7B4 File Offset: 0x000AA9B4
// (set) Token: 0x06003235 RID: 12853 RVA: 0x000AC7BC File Offset: 0x000AA9BC
public string Role
{
get
{
return this.role;
}
set
{
this.role = value;
}
}
/// <summary>Creates and returns a new <see cref="T:System.Security.Permissions.PrincipalPermission" />.</summary>
/// <returns>A <see cref="T:System.Security.Permissions.PrincipalPermission" /> that corresponds to this attribute.</returns>
// Token: 0x06003236 RID: 12854 RVA: 0x000AC7C8 File Offset: 0x000AA9C8
public override IPermission CreatePermission()
{
PrincipalPermission principalPermission;
if (base.Unrestricted)
{
principalPermission = new PrincipalPermission(PermissionState.Unrestricted);
}
else
{
principalPermission = new PrincipalPermission(this.name, this.role, this.authenticated);
}
return principalPermission;
}
// Token: 0x0400149B RID: 5275
private bool authenticated;
// Token: 0x0400149C RID: 5276
private string name;
// Token: 0x0400149D RID: 5277
private string role;
}
}