directory.xml 파일의 ImsManagedObjectAttrValidation 요소를 통해 CA IdentityMinder에 유효성 검사 규칙 및 규칙 세트를 정의합니다.
ImsManagedObjectAttrValidation 요소의 스키마는 다음과 같습니다.
<xs:element name="ImsManagedObjectAttrValidation" minOccurs="0">
<xs:complexType>
<xs:sequence>
<xs:element name="ValidationRule" minOccurs="0"
maxOccurs="unbounded">
<xs:complexType>
<xs:choice>
<xs:element name="Java">
<xs:complexType>
<xs:attribute name="class" type="xs:string"
use="required"/>
</xs:complexType>
</xs:element>
<xs:element name="JavaScript">
<xs:complexType>
<xs:simpleContent>
<xs:extension base="xs:string"/>
</xs:simpleContent>
</xs:complexType>
</xs:element>
<xs:element name="JavaScriptFile">
<xs:complexType>
<xs:attribute name="file" type="xs:string"
use="required"/>
</xs:complexType>
</xs:element>
<xs:element name="RegularExpression">
<xs:complexType>
<xs:simpleContent>
<xs:extension base="xs:string"/>
</xs:simpleContent>
</xs:complexType>
</xs:element>
</xs:choice>
<xs:attribute name="name" type="xs:string"
use="required"/>
<xs:attribute name="description" type="xs:string"
use="optional"/>
<xs:attribute name="messageid" type="xs:string"
use="required"/>
</xs:complexType>
</xs:element>
<xs:element name="ValidationRuleSet" minOccurs="0"
maxOccurs="unbounded">
<xs:complexType>
<xs:sequence>
<xs:element name="ValidationRule"
maxOccurs="unbounded">
<xs:complexType>
<xs:attribute name="name" type="xs:string"
use="required"/>
</xs:complexType>
</xs:element>
</xs:sequence>
<xs:attribute name="name" type="xs:string"
use="required"/>
<xs:attribute name="description" type="xs:string"
use="optional"/>
</xs:complexType>
</xs:element>
</xs:sequence>
</xs:complexType>
</xs:element>
다음 요소가 정의됩니다.
미리 정의된 유효성 검사 규칙 또는 사용자 지정 유효성 검사 규칙을 하나 이상 구성합니다. 유효성 검사 규칙은 ValidationRule 요소에 지정됩니다.
미리 정의된 규칙과 사용자 지정 규칙 모두 동일한 규칙 세트에 나타날 수 있습니다. 또한 규칙 세트는 Java, JavaScript 및 정규식 구현의 모든 조합을 포함할 수 있습니다.
유효성 검사 규칙은 ValidationRuleSet에 나타나는 순서대로 실행됩니다. 이를 통해 한 규칙의 출력이 다음 규칙의 입력으로 사용되는 단계별 유효성 검사를 구현할 수 있습니다.
ValidationRuleSet는 directory.xml 파일의 ImsManagedObjectAttr 요소에서 관리 개체 특성과 연결됩니다.
ValidationRuleSet에서 사용할 유효성 검사 규칙을 지정합니다.
ValidationRule은 다음 하위 요소 중 하나만 포함해야 합니다.
앞서 설명한 요소의 특성 대부분은 의미를 쉽게 알 수 있습니다. 하지만 다음과 같은 특성에는 설명이 필요합니다.
Java 유효성 검사 규칙에서는 응용 프로그램 서버 내 다음 루트 위치에 Java 클래스를 배포해야 합니다.
iam_im.ear\custom
이 루트 위치에 있는 클래스 파일은 정규화되어야 하며 다른 경로 정보가 필요하지 않습니다(예: com.mycompany.MyJavaImpl).
JavaScript 원본 파일에서 구현된 유효성 검사 규칙에서는 응용 프로그램 서버의 다음과 같은 루트 위치에 파일을 배포해야 합니다.
iam_im.ear\custom\validationscripts
이 루트 위치의 JavaScript 원본 파일은 이름으로만 참조됩니다(예: MyJavaScriptImpl.js).
이 특성에 지정된 메지지 ID가 리소스 번들 IMSExceptions.properties의 오류 메시지에 매핑됩니다.
모든 유형의 유효성 검사 규칙(Java, JavaScript, JavaScriptFile 및 RegularExpression)은 messageid 특성을 포함합니다.
예: 인라인 정규식
다음 예에서는 Phone format 규칙 세트에 포함된 미리 정의된 Phone pattern 유효성 검사 규칙을 보여 줍니다. 이 규칙은 인라인 정규식으로 구현됩니다.
<ValidationRule name="Phone pattern" description="+nn nnn-nnn-nnnn" messageid="4001"> <RegularExpression> <![CDATA[ ((\+|\d)*+(\s*|\x2D))?\d\d\d-\d\d\d-\d\d\d\d]]> </RegularExpression> </ValidationRule> <ValidationRuleSet name="Phone format" description= "Verify format +nn nnn-nnn-nnnn"> <ValidationRule name="Phone pattern" /> </ValidationRuleSet>
앞의 예에서 messageid="4001"은 IMSExceptions.properties의 다음 줄에 매핑됩니다.
4001=Attribute Validation: {0} value must match regular expression
nnn-nnn-nnnn.
예: JavaScript 파일에 대한 참조
다음 예에서는 EndWithZ_js 규칙을 지정합니다. 이 규칙은 JavaScript로 구현되며 스크립트는 EndWithZ.js 파일에 위치합니다. 규칙이 포함된 규칙 세트는 이 예에 나와 있지 않습니다.
<ValidationRule name="EndWithZ_js" messageid="custom-5001"> <JavaScriptFile file="EndWithZ.js" /> </ValidationRule>
앞의 예에서 JavaScript 파일은 다음 기본 위치에 있다고 가정합니다.
iam_im.ear\custom\validationscripts
|
Copyright © 2014 CA.
All rights reserved.
|
|