NetCodeGroup 클래스

정의

어셈블리를 다운로드한 사이트에 웹 권한을 부여합니다. 이 클래스는 상속될 수 없습니다.

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
상속
NetCodeGroup
특성

예제

다음 코드 예제에서는 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 는 의 병합 의미 체계 UnionCodeGroup와 같으며, 일치하는 모든 자식 코드 그룹의 개체의 합집 PolicyStatement 합을 형성하고 PolicyStatement 입력 Url 증명 정보에서 생성합니다. 그러나 NetCodeGroup 는 코드가 실행되는 UnionCodeGroup 사이트에 대한 연결 액세스 권한을 부여하는 동적으로 계산 WebPermission 된 를 포함하는 권한을 반환합니다. 정적 권한 집합을 반환하기만 하면 됩니다.

NetCodeGroup 이 만들어지면 다음 표에 표시된 기본 연결 액세스 규칙이 포함됩니다.

URI 스키마 규칙
파일 원본 서버에 대한 연결 액세스는 허용되지 않습니다.
http 원본 포트를 사용하여 HTTP 및 HTTPS 액세스를 허용합니다.
https 원본 포트를 사용하여 HTTPS 액세스가 허용됩니다.

적절한 Scheme 및 속성 값이 있는 개체를 메서드에 전달 CodeConnectAccess 하여 코드가 원본 사이트에 다시 연결할 때 사용할 수 있는 구성표 및 Port 포트를 AddConnectAccess 제어할 수 있습니다. 원본 구성표가 증명 정보에 없거나 ("")를 스키마로 지정하여 AbsentOriginScheme 인식되지 않을 때 적용되는 연결 액세스 규칙을 만들 수 있습니다. ("*")을 스키마로 지정 AnyOtherOriginScheme 하여 일치하는 스키마가 있는 연결 액세스 규칙이 없는 경우 적용되는 연결 액세스 규칙을 만들 수도 있습니다.

참고

코드가 URI 체계를 증명 정보로 제출하지 않으면 원본 사이트로 다시 스키마를 사용하여 액세스할 수 있습니다.

생성자

NetCodeGroup(IMembershipCondition)

NetCodeGroup 클래스의 새 인스턴스를 초기화합니다.

필드

AbsentOriginScheme

알 수 없거나 인식할 수 없는 원래 체계를 사용하여 코드에 대한 연결 액세스를 지정하는 데 사용되는 값을 포함합니다.

AnyOtherOriginScheme

지정되지 않은 다른 원래 체계를 지정하는 데 사용되는 값을 포함합니다.

속성

AttributeString

코드 그룹에 대한 정책 문의 특성을 나타내는 문자열 표현을 가져옵니다.

Children

코드 그룹의 자식 코드 그룹에 대한 순서 있는 목록을 가져오거나 설정합니다.

(다음에서 상속됨 CodeGroup)
Description

코드 그룹의 설명을 가져오거나 설정합니다.

(다음에서 상속됨 CodeGroup)
MembershipCondition

코드 그룹의 멤버 자격 조건을 가져오거나 설정합니다.

(다음에서 상속됨 CodeGroup)
MergeLogic

그룹 병합에 사용할 논리를 가져옵니다.

Name

코드 그룹의 이름을 가져오거나 설정합니다.

(다음에서 상속됨 CodeGroup)
PermissionSetName

코드 그룹에 대한 NamedPermissionSet 이름을 가져옵니다.

PolicyStatement

코드 그룹과 관련된 정책 문을 가져오거나 설정합니다.

(다음에서 상속됨 CodeGroup)

메서드

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)

XML 인코딩을 사용하여 지정된 상태로 보안 개체를 다시 만듭니다.

(다음에서 상속됨 CodeGroup)
FromXml(SecurityElement, PolicyLevel)

보안 개체를 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)

적용 대상