NetCodeGroup 클래스
정의
중요
일부 정보는 릴리스되기 전에 상당 부분 수정될 수 있는 시험판 제품과 관련이 있습니다. Microsoft는 여기에 제공된 정보에 대해 어떠한 명시적이거나 묵시적인 보증도 하지 않습니다.
어셈블리가 다운로드된 사이트에 웹 권한을 부여합니다. 이 클래스는 상속할 수 없습니다.
public ref class NetCodeGroup sealed : System::Security::Policy::CodeGroup
public sealed class NetCodeGroup : System.Security.Policy.CodeGroup
[System.Serializable]
public sealed class NetCodeGroup : System.Security.Policy.CodeGroup
[System.Serializable]
[System.Runtime.InteropServices.ComVisible(true)]
public sealed class NetCodeGroup : System.Security.Policy.CodeGroup
type NetCodeGroup = class
inherit CodeGroup
[<System.Serializable>]
type NetCodeGroup = class
inherit CodeGroup
[<System.Serializable>]
[<System.Runtime.InteropServices.ComVisible(true)>]
type NetCodeGroup = class
inherit CodeGroup
Public NotInheritable Class NetCodeGroup
Inherits CodeGroup
- 상속
- 특성
예제
다음 코드 예제에서는 HTTP 스키마를 NetCodeGroup 사용하여 다운로드한 코드에 대한 개체를 만들고 추가하는 CodeConnectAccess 방법을 보여 줍니다.
static void SetNetCodeGroupAccess()
{
String^ userPolicyLevel = "User";
// Locate the User policy level.
PolicyLevel^ level = nullptr;
System::Collections::IEnumerator^ ph =
System::Security::SecurityManager::PolicyHierarchy();
while(ph->MoveNext())
{
level = (PolicyLevel^)ph->Current;
if (level->Label == userPolicyLevel)
{
break;
}
}
if (level->Label != userPolicyLevel)
throw gcnew ApplicationException("Could not find User policy level.");
IMembershipCondition^ membership =
gcnew UrlMembershipCondition("http://www.contoso.com/*");
NetCodeGroup^ codeGroup = gcnew NetCodeGroup(membership);
// Delete default settings.
codeGroup->ResetConnectAccess();
// Create an object that represents access to the FTP scheme and
// default port.
CodeConnectAccess^ CodeAccessFtp =
gcnew CodeConnectAccess(Uri::UriSchemeFtp,
CodeConnectAccess::DefaultPort);
// Create an object that represents access to the HTTPS scheme
// and default port.
CodeConnectAccess^ CodeAccessHttps =
gcnew CodeConnectAccess(Uri::UriSchemeHttps,
CodeConnectAccess::DefaultPort);
// Create an object that represents access to the origin
// scheme and port.
CodeConnectAccess^ CodeAccessOrigin =
CodeConnectAccess::CreateOriginSchemeAccess
(CodeConnectAccess::OriginPort);
// Add connection access objects to the NetCodeGroup object.
codeGroup->AddConnectAccess(Uri::UriSchemeHttp, CodeAccessFtp);
codeGroup->AddConnectAccess(Uri::UriSchemeHttp, CodeAccessHttps);
codeGroup->AddConnectAccess(Uri::UriSchemeHttp, CodeAccessOrigin);
// Provide name and description information for caspol.exe tool.
codeGroup->Name = "ContosoHttpCodeGroup";
codeGroup->Description = "Code originating from contoso.com can" +
" connect back using the FTP or HTTPS.";
// Add the code group to the User policy's root node.
level->RootCodeGroup->AddChild(codeGroup);
// Save the changes to the policy level.
System::Security::SecurityManager::SavePolicy();
}
public static void SetNetCodeGroupAccess()
{
const string userPolicyLevel = "User";
// Locate the User policy level.
PolicyLevel level = null;
System.Collections.IEnumerator ph =
System.Security.SecurityManager.PolicyHierarchy();
while(ph.MoveNext())
{
level = (PolicyLevel)ph.Current;
if( level.Label == userPolicyLevel )
{
break;
}
}
if (level.Label != userPolicyLevel)
throw new ApplicationException("Could not find User policy level.");
IMembershipCondition membership =
new UrlMembershipCondition(@"http://www.contoso.com/*");
NetCodeGroup codeGroup = new NetCodeGroup(membership);
// Delete default settings.
codeGroup.ResetConnectAccess();
// Create an object that represents access to the FTP scheme and default port.
CodeConnectAccess a1 = new CodeConnectAccess(Uri.UriSchemeFtp, CodeConnectAccess.DefaultPort);
// Create an object that represents access to the HTTPS scheme and default port.
CodeConnectAccess a2 = new CodeConnectAccess(Uri.UriSchemeHttps, CodeConnectAccess.DefaultPort);
// Create an object that represents access to the origin scheme and port.
CodeConnectAccess a3 = CodeConnectAccess.CreateOriginSchemeAccess(CodeConnectAccess.OriginPort);
// Add connection access objects to the NetCodeGroup object.
codeGroup.AddConnectAccess(Uri.UriSchemeHttp, a1);
codeGroup.AddConnectAccess(Uri.UriSchemeHttp, a2);
codeGroup.AddConnectAccess(Uri.UriSchemeHttp, a3);
// Provide name and description information for caspol.exe tool.
codeGroup.Name = "ContosoHttpCodeGroup";
codeGroup.Description = "Code originating from contoso.com can connect back using the FTP or HTTPS.";
// Add the code group to the User policy's root node.
level.RootCodeGroup.AddChild(codeGroup);
// Save the changes to the policy level.
System.Security.SecurityManager.SavePolicy();
}
설명
코드 그룹은 코드 액세스 보안 정책의 구성 요소입니다. 각 정책 수준은 하나 이상의 자식 코드 그룹을 가질 수 있는 루트 코드 그룹으로 구성됩니다. 각 자식 코드 그룹에는 자체 자식 코드 그룹이 있을 수 있습니다. 이 동작은 여러 수준으로 확장되며 트리를 형성합니다. 각 코드 그룹에는 해당 어셈블리에 대한 증명 정보를 기반으로 지정된 어셈블리가 그룹에 속하는지 여부를 결정하는 멤버 자격 조건이 있습니다. 멤버 자격 조건이 지정된 어셈블리와 일치하는 코드 그룹과 자식 코드 그룹만 코드 액세스 보안 정책을 적용합니다.
NetCodeGroup는 일치하는 모든 자식 코드 그룹의 개체의 합집합 PolicyStatement 을 형성하고 입력 Url 증명 정보에서 생성되는 병합 의미 체계UnionCodeGroup를 PolicyStatement 갖습니다. 그러나 NetCodeGroup 코드가 실행되는 사이트에 대한 연결 액세스 권한을 부여하는 동적으로 계산 WebPermission 된 권한을 포함하는 사용 권한을 반환합니다 UnionCodeGroup . 정적 사용 권한 집합만 반환합니다.
NetCodeGroup 만들 때 다음 표에 표시된 기본 연결 액세스 규칙이 포함됩니다.
| URI 체계 | 규칙 |
|---|---|
| 파일 | 원본 서버에 대한 연결 액세스는 허용되지 않습니다. |
| http | HTTP 및 HTTPS 액세스는 원본 포트를 사용하여 허용됩니다. |
| https | 원본 포트를 사용하여 HTTPS 액세스를 허용합니다. |
적절한 Scheme 속성 값이 있는 개체를 메서드에 전달하여 코드가 원본 사이트로 다시 연결할 때 사용할 수 있는 CodeConnectAccess 구성표 및 Port 포트를 제어할 AddConnectAccess 수 있습니다. 원본 구성표가 증거에 없거나 ("")를 스키마로 지정하여 AbsentOriginScheme 인식되지 않을 때 적용되는 연결 액세스 규칙을 만들 수 있습니다. ("*")를 스키마로 지정하여 AnyOtherOriginScheme 일치하는 스키마가 있는 연결 액세스 규칙이 없는 경우 적용되는 연결 액세스 규칙을 만들 수도 있습니다.
메모
코드가 URI 체계를 증명 정보로 제출하지 않으면 모든 체계를 사용하여 원본 사이트로 다시 액세스할 수 있습니다.
생성자
| Name | Description |
|---|---|
| NetCodeGroup(IMembershipCondition) |
NetCodeGroup 클래스의 새 인스턴스를 초기화합니다. |
필드
| Name | Description |
|---|---|
| AbsentOriginScheme |
알 수 없거나 인식할 수 없는 원본 구성표를 사용하여 코드에 대한 연결 액세스를 지정하는 데 사용되는 값을 포함합니다. |
| AnyOtherOriginScheme |
지정되지 않은 다른 원본 구성표를 지정하는 데 사용되는 값을 포함합니다. |
속성
| Name | Description |
|---|---|
| AttributeString |
코드 그룹에 대한 정책 문의 특성에 대한 문자열 표현을 가져옵니다. |
| Children |
코드 그룹의 자식 코드 그룹의 순서가 지정된 목록을 가져오거나 설정합니다. (다음에서 상속됨 CodeGroup) |
| Description |
코드 그룹에 대한 설명을 가져오거나 설정합니다. (다음에서 상속됨 CodeGroup) |
| MembershipCondition |
코드 그룹의 멤버 자격 조건을 가져오거나 설정합니다. (다음에서 상속됨 CodeGroup) |
| MergeLogic |
그룹 병합에 사용할 논리를 가져옵니다. |
| Name |
코드 그룹의 이름을 가져오거나 설정합니다. (다음에서 상속됨 CodeGroup) |
| PermissionSetName |
코드 그룹의 이름을 NamedPermissionSet 가져옵니다. |
| PolicyStatement |
코드 그룹과 연결된 정책 문을 가져오거나 설정합니다. (다음에서 상속됨 CodeGroup) |
메서드
| Name | Description |
|---|---|
| AddChild(CodeGroup) |
현재 코드 그룹에 자식 코드 그룹을 추가합니다. (다음에서 상속됨 CodeGroup) |
| AddConnectAccess(String, CodeConnectAccess) |
지정된 연결 액세스를 현재 코드 그룹에 추가합니다. |
| Copy() |
현재 코드 그룹의 전체 복사본을 만듭니다. |
| CreateXml(SecurityElement, PolicyLevel) |
파생 클래스에서 재정의되는 경우 파생된 코드 그룹에 한정된 속성 및 내부 상태를 serialize하고 지정된 SecurityElement에 serialization을 추가합니다. (다음에서 상속됨 CodeGroup) |
| Equals(CodeGroup, Boolean) |
지정된 코드 그룹이 현재 코드 그룹과 동일한지 여부를 확인하고 자식 코드 그룹도 확인합니다(지정된 경우). (다음에서 상속됨 CodeGroup) |
| Equals(Object) |
지정된 코드 그룹이 현재 코드 그룹과 동일한지 여부를 확인합니다. |
| Equals(Object) |
지정된 코드 그룹이 현재 코드 그룹과 동일한지 여부를 확인합니다. (다음에서 상속됨 CodeGroup) |
| FromXml(SecurityElement, PolicyLevel) |
XML 인코딩에서 지정된 상태 및 정책 수준으로 보안 개체를 다시 구성합니다. (다음에서 상속됨 CodeGroup) |
| FromXml(SecurityElement) |
XML 인코딩에서 지정된 상태로 보안 개체를 다시 구성합니다. (다음에서 상속됨 CodeGroup) |
| GetConnectAccessRules() |
현재 코드 그룹에 대한 연결 액세스 정보를 가져옵니다. |
| GetHashCode() |
현재 코드 그룹의 해시 코드를 가져옵니다. |
| GetHashCode() |
현재 코드 그룹의 해시 코드를 가져옵니다. (다음에서 상속됨 CodeGroup) |
| GetType() |
현재 인스턴스의 Type 가져옵니다. (다음에서 상속됨 Object) |
| MemberwiseClone() |
현재 Object단순 복사본을 만듭니다. (다음에서 상속됨 Object) |
| ParseXml(SecurityElement, PolicyLevel) |
파생 클래스에서 재정의되는 경우 지정된 SecurityElement코드 그룹에서 파생된 코드 그룹과 관련된 속성 및 내부 상태를 다시 구성합니다. (다음에서 상속됨 CodeGroup) |
| RemoveChild(CodeGroup) |
지정된 자식 코드 그룹을 제거합니다. (다음에서 상속됨 CodeGroup) |
| ResetConnectAccess() |
현재 코드 그룹에 대한 모든 연결 액세스 정보를 제거합니다. |
| Resolve(Evidence) |
증명 정보 집합에 대한 코드 그룹 및 해당 하위 항목에 대한 정책을 확인합니다. |
| ResolveMatchingCodeGroups(Evidence) |
일치하는 코드 그룹을 확인합니다. |
| ToString() |
현재 개체를 나타내는 문자열을 반환합니다. (다음에서 상속됨 Object) |
| ToXml() |
보안 개체 및 현재 상태의 XML 인코딩을 만듭니다. (다음에서 상속됨 CodeGroup) |
| ToXml(PolicyLevel) |
보안 개체, 현재 상태 및 코드가 있는 정책 수준의 XML 인코딩을 만듭니다. (다음에서 상속됨 CodeGroup) |