การติดตั้ง Shibboleth Single Sign-On
ตอนที่ 5 - ทำให้ Apache เห็น SP และส่งต่อไป IdP

9. ทำให้ Apache Web Server เห็น Shibboleth SP

วิธีการทำให้ Apache Web Server ส่งการควบคุมรักษาความปลอดภัย ให้ Shibboleth SP เป็นผู้ดูแลแทนให้นั้น เราจะต้องแก้ไขไฟล์ httpd.conf เพื่อรวมเอาไฟล์คอนฟิก apache22.config ที่ Shibboleth SP ได้เตรียมไว้แล้วในโฟลเดอร์ etc โดยกำหนดให้ Apache Web Server มาอ่านค่าคอนฟิกจากในไฟล์นี้ไปใช้งานร่วมด้วยในขณะที่สตาทร์เว็บเซิร์ฟเวอร์

9.1 แก้ไขไฟล์ httpd.conf

เปิดไฟล์ httpd.conf ที่โฟลเดอร์ c:\sso\Apache2.2\conf ขึ้นมาแก้ไขโดยเพิ่มคำสั่ง Include เข้าไปเป็นบรรทัดสุดท้ายในไฟล์ ดังนี้
Include "C:/sso/shibboleth-sp/etc/shibboleth/apache22.config"
บันทึกไฟล์ httpd.conf ไว้แล้วดำเนินการที่ขั้นตอนต่อไป

9.2 ทดสอบว่า Shibboleth SP รับรีเควสต์ได้

หลังจากรีสตาทร์ Apache Web Server อีกครั้งแล้วให้เบราซ์ไปที่ http://127.0.0.1/Shibboleth.sso ควรจะปรากฏการตอบสนองออกมาดังนี้

รูปภาพ 38 เมื่อเบราซ์ไปที่ http://127.0.0.1/Shibboleth.sso มีการตอบสนองมาจากเซอร์วิสของ Shibboleth SP
จากภาพข้างต้น แม้ว่าปัจจุบัน Shibboleth SP จะยังทำงานไม่ถูกต้อง เนื่องจากเรายังไม่ได้ต่อเชื่อมเข้ากับ IdP แต่ถ้ามีการตอบสนองกลับมาเช่นนี้แสดงว่าการเชื่อมต่อระหว่าง Apache Web Server กับ Shibboleth SP เป็นไปอย่างถูกต้อง

10. ทำให้ Shibbolet SP ส่งต่อไปที่ IdP

วิธีการทำให้ SP ส่งต่อการล็อกอินเข้าสู่ระบบให้กับ IdP เราจำเป็นต้องแก้ไขค่าคอนฟิกดังต่อไปนี้

10.1 ตั้งชื่อ entityID ให้กับ IdP

ก็อปปีไฟล์ idp-metadata.xml เก็บไว้ก่อนเป็นไฟล์ idp-metadata.xml.bak ดังนี้

รูปภาพ 39 ไปที่โฟลเดอร์ c:\sso\shibboleth-idp\metadata แล้วแบ็คอัพไฟล์ idp-metadata.xml เก็บไว้ก่อน
เปิดไฟล์ idp-metadata.xml ขึ้นมาเพื่อแก้ไขดังต่อไปนี้
ซอร์สโค้ด 2 ไฟล์ idp-metadata.xml (แก้ไขชื่อ entityID และหมายเลขพอร์ตเป็น 8443)
1
<EntityDescriptor entityID="urn:federation:idp"
2
                  xmlns="urn:oasis:names:tc:SAML:2.0:metadata"
3
                  xmlns:ds="http://www.w3.org/2000/09/xmldsig#"
4
                  xmlns:shibmd="urn:mace:shibboleth:metadata:1.0"
5
                  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
6

7
        <IDPSSODescriptor protocolSupportEnumeration="urn:mace:shibboleth:1.0 urn:oasis:names:tc:SAML:1.1:protocol urn:oasis:names:tc:SAML:2.0:protocol">
8

9
        <Extensions>
10
            <shibmd:Scope regexp="false">0.1</shibmd:Scope>
11
        </Extensions>
12

13
        <KeyDescriptor>
14
            <ds:KeyInfo>
15
                <ds:X509Data>
16
                    <ds:X509Certificate>
17

18
MIIDFDCCAfygAwIBAgIVAKtK9tKVS9hXWYJvVAQ9SKBMRLPBMA0GCSqGSIb3DQEB
19
BQUAMBQxEjAQBgNVBAMTCTEyNy4wLjAuMTAiGA8yNTUyMDIyMDAyNDUyNloYDzI1
20
NzIwMjIwMDI0NTI2WjAUMRIwEAYDVQQDEwkxMjcuMC4wLjEwggEiMA0GCSqGSIb3
21
DQEBAQUAA4IBDwAwggEKAoIBAQCKmzl6fppsmvxgjziHZCrxRKYDLhKd91oKBABW
22
4ujIBcUg59HJv3K83z3GIOGn9vNXzVcHlrpFVPlW+VXto9QDzmiqAGC5YKRbFnep
23
fFObGkQQCivclfveyN6K2xN6/Bf1AXlMLg3g/EgQGY5puToobfLpOlEciCSP7Xkh
24
lyw2iGibCOdNsYcc6TEAV/MKoAeM7J9FparB/uF03Vi6qh03BfqEfANuwJP9QyHQ
25
Ezz21yG2blMNcSyvRGiegmvgGkNCBkYeLd2DPy/xBWMRGQTWyxEUtCa8x27A5Bbn
26
5aI+Qj2TYHW8AED5714juPFhHGfvwryOUMYH18Mu+E1qwxI7AgMBAAGjWTBXMDYG
27
A1UdEQQvMC2CCTEyNy4wLjAuMYYgaHR0cHM6Ly8xMjcuMC4wLjEvaWRwL3NoaWJi
28
b2xldGgwHQYDVR0OBBYEFNyV6IhIGfjvLQonwprvNXXJbwsWMA0GCSqGSIb3DQEB
29
BQUAA4IBAQBMSEbEgpmqaZLkfVQYJgykaPcYmpKd+T9J/D5o7ON72wDIbLoJJgWv
30
rjF3VZmSxK9SVhMLmRurGK1G/B2zqc8GT/Fn3y87U7KV5wCqd58AKXtC7dJlJW2T
31
DNmp4q3mF400zQi0x2HCtkCKnudvancNHydMTuH7FJGayL9EZ9yNnIpvIgH95nW1
32
vYaswXPl5ROtogzvsYm9QHGcoqVRwFem2HIc1Bh5mVQ+tGJIMLpg+fltDs+8pcVk
33
dF75Xhn082M7nS+740K3Mom86jnAKHzv1XQ+KcNGMXLP87Lkd56vHwouwiHa1OqN
34
iuqNTFctYwHCuJU3FzxjkK4HFEvTW/IQ
35

36
                    </ds:X509Certificate>
37
                </ds:X509Data>
38
            </ds:KeyInfo>
39
        </KeyDescriptor>
40
        
41
        <ArtifactResolutionService Binding="urn:oasis:names:tc:SAML:1.0:bindings:SOAP-binding"
42
                                   Location="https://127.0.0.1:8443/idp/profile/SAML1/SOAP/ArtifactResolution" 
43
                                   index="1"/>
44

45
        <ArtifactResolutionService Binding="urn:oasis:names:tc:SAML:2.0:bindings:SOAP"
46
                                   Location="https://127.0.0.1:8443/idp/profile/SAML2/SOAP/ArtifactResolution" 
47
                                   index="2"/>
48
                                   
49
        <NameIDFormat>urn:mace:shibboleth:1.0:nameIdentifier</NameIDFormat>
50
        <NameIDFormat>urn:oasis:names:tc:SAML:2.0:nameid-format:transient</NameIDFormat>
51

52
        <SingleSignOnService Binding="urn:mace:shibboleth:1.0:profiles:AuthnRequest" 
53
                             Location="https://127.0.0.1:8443/idp/profile/Shibboleth/SSO" />
54
        
55
        <SingleSignOnService Binding="urn:oasis:names:tc:SAML:2.0:bindings:HTTP-POST" 
56
                             Location="https://127.0.0.1:8443/idp/profile/SAML2/POST/SSO" />
57

58
        <SingleSignOnService Binding="urn:oasis:names:tc:SAML:2.0:bindings:HTTP-POST-SimpleSign" 
59
                             Location="https://127.0.0.1:8443/idp/profile/SAML2/POST-SimpleSign/SSO" />
60
        
61
        <SingleSignOnService Binding="urn:oasis:names:tc:SAML:2.0:bindings:HTTP-Redirect" 
62
                             Location="https://127.0.0.1:8443/idp/profile/SAML2/Redirect/SSO" />
63
        </IDPSSODescriptor>
64

65
        <AttributeAuthorityDescriptor protocolSupportEnumeration="urn:oasis:names:tc:SAML:1.1:protocol urn:oasis:names:tc:SAML:2.0:protocol">
66

67
        <Extensions>
68
            <shibmd:Scope regexp="false">0.1</shibmd:Scope>
69
        </Extensions>
70

71
        <KeyDescriptor>
72
            <ds:KeyInfo>
73
                <ds:X509Data>
74
                    <ds:X509Certificate>
75

76
MIIDFDCCAfygAwIBAgIVAKtK9tKVS9hXWYJvVAQ9SKBMRLPBMA0GCSqGSIb3DQEB
77
BQUAMBQxEjAQBgNVBAMTCTEyNy4wLjAuMTAiGA8yNTUyMDIyMDAyNDUyNloYDzI1
78
NzIwMjIwMDI0NTI2WjAUMRIwEAYDVQQDEwkxMjcuMC4wLjEwggEiMA0GCSqGSIb3
79
DQEBAQUAA4IBDwAwggEKAoIBAQCKmzl6fppsmvxgjziHZCrxRKYDLhKd91oKBABW
80
4ujIBcUg59HJv3K83z3GIOGn9vNXzVcHlrpFVPlW+VXto9QDzmiqAGC5YKRbFnep
81
fFObGkQQCivclfveyN6K2xN6/Bf1AXlMLg3g/EgQGY5puToobfLpOlEciCSP7Xkh
82
lyw2iGibCOdNsYcc6TEAV/MKoAeM7J9FparB/uF03Vi6qh03BfqEfANuwJP9QyHQ
83
Ezz21yG2blMNcSyvRGiegmvgGkNCBkYeLd2DPy/xBWMRGQTWyxEUtCa8x27A5Bbn
84
5aI+Qj2TYHW8AED5714juPFhHGfvwryOUMYH18Mu+E1qwxI7AgMBAAGjWTBXMDYG
85
A1UdEQQvMC2CCTEyNy4wLjAuMYYgaHR0cHM6Ly8xMjcuMC4wLjEvaWRwL3NoaWJi
86
b2xldGgwHQYDVR0OBBYEFNyV6IhIGfjvLQonwprvNXXJbwsWMA0GCSqGSIb3DQEB
87
BQUAA4IBAQBMSEbEgpmqaZLkfVQYJgykaPcYmpKd+T9J/D5o7ON72wDIbLoJJgWv
88
rjF3VZmSxK9SVhMLmRurGK1G/B2zqc8GT/Fn3y87U7KV5wCqd58AKXtC7dJlJW2T
89
DNmp4q3mF400zQi0x2HCtkCKnudvancNHydMTuH7FJGayL9EZ9yNnIpvIgH95nW1
90
vYaswXPl5ROtogzvsYm9QHGcoqVRwFem2HIc1Bh5mVQ+tGJIMLpg+fltDs+8pcVk
91
dF75Xhn082M7nS+740K3Mom86jnAKHzv1XQ+KcNGMXLP87Lkd56vHwouwiHa1OqN
92
iuqNTFctYwHCuJU3FzxjkK4HFEvTW/IQ
93

94
                    </ds:X509Certificate>
95
                </ds:X509Data>
96
            </ds:KeyInfo>
97
        </KeyDescriptor>
98

99
        <AttributeService Binding="urn:oasis:names:tc:SAML:1.0:bindings:SOAP-binding" 
100
                          Location="https://127.0.0.1:8443/idp/profile/SAML1/SOAP/AttributeQuery" />
101
        
102
        <AttributeService Binding="urn:oasis:names:tc:SAML:2.0:bindings:SOAP"
103
                          Location="https://127.0.0.1:8443/idp/profile/SAML2/SOAP/AttributeQuery" />
104
        
105
        <NameIDFormat>urn:mace:shibboleth:1.0:nameIdentifier</NameIDFormat>
106
        <NameIDFormat>urn:oasis:names:tc:SAML:2.0:nameid-format:transient</NameIDFormat>
107
        
108
        </AttributeAuthorityDescriptor>
109
        
110
</EntityDescriptor>    
ให้แก้ไขชื่อ entityID เป็น urn:federation:idp และตรวจสอบหมายเลขพอร์ตของ https ให้เป็น 8443 ให้หมดทุก URL โดยเฉพาะแอททริบิวท์ Location จำเป็นต้องชี้มาที่ IdP ที่รันไว้ที่ Tomcat อย่างถูกต้อง
** สำคัญมาก ที่บรรทัดที่ 52 – 63 หากไม่ได้เติมหมายเลขพอร์ต 8443 เข้าไป จะทำให้ขั้นตอนถัดไปไม่สามารถเบราซ์ไปที่ตำแหน่ง http://127.0.0.1/secure ได้ โดยไม่มีข้อผิดพลาดแจ้งบอกให้ทราบบนหน้าเว็บ และตรวจสอบค่อนข้างยาก

10.2 ก็อปปีไฟล์ idp-metadata.xml ไปที่ SP

ให้ก็อปปีไฟล์ idp-metadata.xml ไปวางไว้ที่ c:\sso\shibboleth-sp\etc\shibboleth ดังนี้

รูปภาพ 40 ไฟล์ที่สำคัญมากใน SP คือ idp-metadata.xml และ shibboleth2.xml

10.3 แก้ไขไฟล์ shibboleth2.xml

ให้แก้ไขไฟล์ shibboleth2.xml เพื่อทำให้มองเห็น IdP โดยแก้ไขที่ entityID และรวมไฟล์ idp-metadata.xml เข้าไปดังนี้
ซอร์สโค้ด 3 ไฟล์ shibboleth2.xml (แก้ไข entityID และรวมไฟล์ idp-metadata.xml)
1
<SPConfig xmlns="urn:mace:shibboleth:2.0:native:sp:config"
2
        xmlns:conf="urn:mace:shibboleth:2.0:native:sp:config"
3
        xmlns:saml="urn:oasis:names:tc:SAML:2.0:assertion"
4
        xmlns:samlp="urn:oasis:names:tc:SAML:2.0:protocol"        
5
        xmlns:md="urn:oasis:names:tc:SAML:2.0:metadata"
6
        logger="syslog.logger" clockSkew="180">
7

8
        <!-- The OutOfProcess section contains properties affecting the shibd daemon. -->
9
        <OutOfProcess logger="shibd.logger">
10
        <!--
11
        <Extensions>
12
            <Library path="odbc-store.so" fatal="true"/>
13
        </Extensions>
14
        -->
15
        </OutOfProcess>
16
        
17
        <!-- The InProcess section conrains settings affecting web server modules/filters. -->
18
        <InProcess logger="native.logger">
19
        <ISAPI normalizeRequest="true">
20
            <!--
21
            Maps IIS Instance ID values to the host scheme/name/port/sslport. The name is
22
            required so that the proper <Host> in the request map above is found without
23
            having to cover every possible DNS/IP combination the user might enter.
24
            The port and scheme can usually be omitted, so the HTTP request's port and
25
            scheme will be used.
26
            -->
27
            <Site id="1" name="sp.example.org"/>
28
        </ISAPI>
29
        </InProcess>
30

31
        <!-- Only one listener can be defined, to connect in process modules to shibd. -->
32
  <!-- <UnixListener address="shibd.sock"/> -->
33
        <TCPListener address="127.0.0.1" port="1600" acl="127.0.0.1"/>
34
        
35
        <!-- This set of components stores sessions and other persistent data in daemon memory. -->
36
        <StorageService type="Memory" id="mem" cleanupInterval="900"/>
37
        <SessionCache type="StorageService" StorageService="mem" cacheTimeout="3600" inprocTimeout="900" cleanupInterval="900"/>
38
        <ReplayCache StorageService="mem"/>
39
        <ArtifactMap artifactTTL="180"/>
40

41
        <!-- This set of components stores sessions and other persistent data in an ODBC database. -->
42
        <!--
43
    <StorageService type="ODBC" id="db" cleanupInterval="900">
44
        <ConnectionString>
45
        DRIVER=drivername;SERVER=dbserver;UID=shibboleth;PWD=password;DATABASE=shibboleth;APP=Shibboleth
46
        </ConnectionString>
47
    </StorageService>
48
    <SessionCache type="StorageService" StorageService="db" cacheTimeout="3600" inprocTimeout="900" cleanupInterval="900"/>
49
    <ReplayCache StorageService="db"/>
50
    <ArtifactMap StorageService="db" artifactTTL="180"/>
51
    -->
52

53
        <!-- To customize behavior, map hostnames and path components to applicationId and other settings. -->
54
        <RequestMapper type="Native">
55
        <RequestMap applicationId="default">
56
            <!--
57
            The example requires a session for documents in /secure on the containing host with http and
58
            https on the default ports. Note that the name and port in the <Host> elements MUST match
59
            Apache's ServerName and Port directives or the IIS Site name in the <ISAPI> element
60
            below.
61
            -->
62
            <Host name="sp.example.org">
63
                <Path name="secure" authType="shibboleth" requireSession="true"/>
64
            </Host>
65
            <!-- Example of a second vhost mapped to a different applicationId. -->
66
            <!--
67
            <Host name="admin.example.org" applicationId="admin" authType="shibboleth" requireSession="true"/>
68
            -->
69
        </RequestMap>
70
        </RequestMapper>
71

72
        <!--
73
    The ApplicationDefaults element is where most of Shibboleth's SAML bits are defined.
74
    Resource requests are mapped by the RequestMapper to an applicationId that
75
    points into to this section.
76
    -->
77
        <ApplicationDefaults id="default" policyId="default"
78
        entityID="urn:federation:sp"
79
        homeURL="https://127.0.0.1/index.html"
80
        REMOTE_USER="eppn persistent-id targeted-id"
81
        signing="false" encryption="false"
82
        >
83

84
        <!--
85
        Controls session lifetimes, address checks, cookie handling, and the protocol handlers.
86
        You MUST supply an effectively unique handlerURL value for each of your applications.
87
        The value can be a relative path, a URL with no hostname (https:///path) or a full URL.
88
        The system can compute a relative value based on the virtual host. Using handlerSSL="true"
89
        will force the protocol to be https. You should also add a cookieProps setting of "; path=/; secure"
90
        in that case. Note that while we default checkAddress to "false", this has a negative
91
        impact on the security of the SP. Stealing cookies/sessions is much easier with this disabled.
92
        -->
93
        <Sessions lifetime="28800" timeout="3600" checkAddress="false"
94
            handlerURL="/Shibboleth.sso" handlerSSL="false"
95
            exportLocation="http://localhost/Shibboleth.sso/GetAssertion" exportACL="127.0.0.1"
96
            idpHistory="false" idpHistoryDays="7">
97
            
98
            <!--
99
            SessionInitiators handle session requests and relay them to a Discovery page,
100
            or to an IdP if possible. Automatic session setup will use the default or first
101
            element (or requireSessionWith can specify a specific id to use).
102
            -->
103

104
            <!-- Default example directs to a specific IdP's SSO service (favoring SAML 2 over Shib 1). -->
105
            <SessionInitiator type="Chaining" Location="/Login" isDefault="true" id="Intranet"
106
                    relayState="cookie" entityID="urn:federation:idp">
107
                <SessionInitiator type="SAML2" defaultACSIndex="1" acsByIndex="false" template="bindingTemplate.html"/>
108
                <SessionInitiator type="Shib1" defaultACSIndex="5"/>
109
            </SessionInitiator>
110
            
111
            <!-- An example using an old-style WAYF, which means Shib 1 only unless an entityID is provided. -->
112
            <!--
113
            <SessionInitiator type="Chaining" Location="/WAYF" id="WAYF" relayState="cookie">
114
                <SessionInitiator type="SAML2" defaultACSIndex="1" acsByIndex="false" template="bindingTemplate.html"/>
115
                <SessionInitiator type="Shib1" defaultACSIndex="5"/>
116
                <SessionInitiator type="WAYF" defaultACSIndex="5" URL="https://wayf.example.org/WAYF"/>
117
            </SessionInitiator>
118
            -->
119

120
            <!-- An example supporting the new-style of discovery service. -->
121
            <!--
122
            <SessionInitiator type="Chaining" Location="/DS" id="DS" relayState="cookie">
123
                <SessionInitiator type="SAML2" defaultACSIndex="1" acsByIndex="false" template="bindingTemplate.html"/>
124
                <SessionInitiator type="Shib1" defaultACSIndex="5"/>
125
                <SessionInitiator type="SAMLDS" URL="https://ds.example.org/DS"/>
126
            </SessionInitiator>
127
            -->
128

129
            <!--
130
            md:AssertionConsumerService locations handle specific SSO protocol bindings,
131
            such as SAML 2.0 POST or SAML 1.1 Artifact. The isDefault and index attributes
132
            are used when sessions are initiated to determine how to tell the IdP where and
133
            how to return the response.
134
            -->
135
            <md:AssertionConsumerService Location="/SAML2/POST" index="1"
136
                Binding="urn:oasis:names:tc:SAML:2.0:bindings:HTTP-POST"/>
137
            <md:AssertionConsumerService Location="/SAML2/POST-SimpleSign" index="2"
138
                Binding="urn:oasis:names:tc:SAML:2.0:bindings:HTTP-POST-SimpleSign"/>
139
            <md:AssertionConsumerService Location="/SAML2/Artifact" index="3"
140
                Binding="urn:oasis:names:tc:SAML:2.0:bindings:HTTP-Artifact"/>
141
            <md:AssertionConsumerService Location="/SAML2/ECP" index="4"
142
                Binding="urn:oasis:names:tc:SAML:2.0:bindings:PAOS"/>
143
            <md:AssertionConsumerService Location="/SAML/POST" index="5"
144
                Binding="urn:oasis:names:tc:SAML:1.0:profiles:browser-post"/>
145
            <md:AssertionConsumerService Location="/SAML/Artifact" index="6"
146
                Binding="urn:oasis:names:tc:SAML:1.0:profiles:artifact-01"/>
147

148
            <!-- LogoutInitiators enable SP-initiated local or global/single logout of sessions. -->
149
            <LogoutInitiator type="Chaining" Location="/Logout" relayState="cookie">
150
                <LogoutInitiator type="SAML2" template="bindingTemplate.html"/>
151
                <LogoutInitiator type="Local"/>
152
            </LogoutInitiator>
153

154
            <!-- md:SingleLogoutService locations handle single logout (SLO) protocol messages. -->
155
            <md:SingleLogoutService Location="/SLO/SOAP"
156
                Binding="urn:oasis:names:tc:SAML:2.0:bindings:SOAP"/>
157
            <md:SingleLogoutService Location="/SLO/Redirect" conf:template="bindingTemplate.html"
158
                Binding="urn:oasis:names:tc:SAML:2.0:bindings:HTTP-Redirect"/>
159
            <md:SingleLogoutService Location="/SLO/POST" conf:template="bindingTemplate.html"
160
                Binding="urn:oasis:names:tc:SAML:2.0:bindings:HTTP-POST"/>
161
            <md:SingleLogoutService Location="/SLO/Artifact" conf:template="bindingTemplate.html"
162
                Binding="urn:oasis:names:tc:SAML:2.0:bindings:HTTP-Artifact"/>
163

164
            <!-- md:ManageNameIDService locations handle NameID management (NIM) protocol messages. -->
165
            <md:ManageNameIDService Location="/NIM/SOAP"
166
                Binding="urn:oasis:names:tc:SAML:2.0:bindings:SOAP"/>
167
            <md:ManageNameIDService Location="/NIM/Redirect" conf:template="bindingTemplate.html"
168
                Binding="urn:oasis:names:tc:SAML:2.0:bindings:HTTP-Redirect"/>
169
            <md:ManageNameIDService Location="/NIM/POST" conf:template="bindingTemplate.html"
170
                Binding="urn:oasis:names:tc:SAML:2.0:bindings:HTTP-POST"/>
171
            <md:ManageNameIDService Location="/NIM/Artifact" conf:template="bindingTemplate.html"
172
                Binding="urn:oasis:names:tc:SAML:2.0:bindings:HTTP-Artifact"/>
173

174
            <!--
175
            md:ArtifactResolutionService locations resolve artifacts issued when using the
176
            SAML 2.0 HTTP-Artifact binding on outgoing messages, generally uses SOAP.
177
            -->
178
            <md:ArtifactResolutionService Location="/Artifact/SOAP" index="1"
179
                Binding="urn:oasis:names:tc:SAML:2.0:bindings:SOAP"/>
180

181
            <!-- Extension service that generates "approximate" metadata based on SP configuration. -->
182
            <Handler type="MetadataGenerator" Location="/Metadata" signing="false"/>
183

184
            <!-- Status reporting service. -->
185
            <Handler type="Status" Location="/Status" acl="127.0.0.1"/>
186

187
            <!-- Session diagnostic service. -->
188
            <Handler type="Session" Location="/Session" showAttributeValues="false"/>
189

190
        </Sessions>
191

192
        <!--
193
        You should customize these pages! You can add attributes with values that can be plugged
194
        into your templates. You can remove the access attribute to cause the module to return a
195
        standard 403 Forbidden error code if authorization fails, and then customize that condition
196
        using your web server.
197
        -->
198
        <Errors session="sessionError.html"
199
            metadata="metadataError.html"
200
            access="accessError.html"
201
            ssl="sslError.html"
202
            localLogout="localLogout.html"
203
            globalLogout="globalLogout.html"
204
            supportContact="root@localhost"
205
            logoLocation="/shibboleth-sp/logo.jpg"
206
            styleSheet="/shibboleth-sp/main.css"/>
207
        
208
        <!-- Uncomment and modify to tweak settings for specific IdPs or groups. -->
209
        <!-- <RelyingParty Name="SpecialFederation" keyName="SpecialKey"/> -->
210

211
        <!-- Chains together all your metadata sources. -->
212
        <MetadataProvider type="Chaining">
213
            <!-- Example of remotely supplied batch of signed metadata. -->
214
            <!--
215
            <MetadataProvider type="XML" uri="http://federation.org/federation-metadata.xml"
216
                 backingFilePath="federation-metadata.xml" reloadInterval="7200">
217
               <SignatureMetadataFilter certificate="fedsigner.pem"/>
218
            </MetadataProvider>
219
            -->
220

221
            <!-- Example of locally maintained metadata. -->
222
            <MetadataProvider type="XML" file="idp-metadata.xml"/>
223
        </MetadataProvider>
224

225
        <!-- Chain the two built-in trust engines together. -->
226
        <TrustEngine type="Chaining">
227
            <TrustEngine type="ExplicitKey"/>
228
            <TrustEngine type="PKIX"/>
229
        </TrustEngine>
230

231
        <!-- Map to extract attributes from SAML assertions. -->
232
        <AttributeExtractor type="XML" path="attribute-map.xml"/>
233
        
234
        <!-- Use a SAML query if no attributes are supplied during SSO. -->
235
        <AttributeResolver type="Query"/>
236

237
        <!-- Default filtering policy for recognized attributes, lets other data pass. -->
238
        <AttributeFilter type="XML" path="attribute-policy.xml"/>
239

240
        <!-- Simple file-based resolver for using a single keypair. -->
241
        <CredentialResolver type="File" key="sp-key.pem" certificate="sp-cert.pem"/>
242

243
        <!-- Example of a second application (using a second vhost) that has a different entityID. -->
244
        <!-- <ApplicationOverride id="admin" entityID="https://admin.example.org/shibboleth"/> -->
245

246
        </ApplicationDefaults>
247
        
248
        <!-- Each policy defines a set of rules to use to secure messages. -->
249
        <SecurityPolicies>
250
        <!-- The predefined policy enforces replay/freshness and permits signing and client TLS. -->
251
        <Policy id="default" validate="false">
252
            <Rule type="MessageFlow" checkReplay="true" expires="60"/>
253
            <Rule type="ClientCertAuth" errorFatal="true"/>
254
            <Rule type="XMLSigning" errorFatal="true"/>
255
            <Rule type="SimpleSigning" errorFatal="true"/>
256
        </Policy>
257
        </SecurityPolicies>
258

259
</SPConfig>
บรรทัดที่ 78                                    กำหนดค่า entityID เป็น urn:federation:sp
บรรทัดที่ 79                                    ใส่ homeURL เป็น https://127.0.0.1/index.html
บรรทัดที่ 106                                  กำหนดค่า entityID ของ IdP เป็น urn:federation:idp
บรรทัดที่ 112 – 127                        ให้คอมเมนต์ SessionInitiator ชื่อว่า WAYF กับ DS ไว้
บรรทัดที่ 222                                  เปิดคอมเมนต์ และแก้ไขให้รวมไฟล์ idp-metadata.xml ไว้

10.4 ทดสอบการส่งต่อจาก SP ไปที่ IdP

ให้รีสตาทร์ Shibboleth 2.0 Daemon และรีสตาทร์ Apache 2.2 และรีสตาทร์ Tomcat เพื่อให้รับค่าคอนฟิกใหม่เข้าไป แล้วทดสอบโดยเบราซ์ไปที่ http://127.0.0.1/secure (หากสงสัยว่าพาธ /secure มาจากไหน พาธนี้ถูกใส่ไว้ในไฟล์ apache22.config และเราได้ Include เข้าไปในไฟล์ httpd.conf เรียบร้อยแล้ว) จะปรากฏภาพดังนี้

รูปภาพ 41 สามารถส่งต่อจาก http://127.0.0.1/secure มาที่ https://127.0.0.1:8443/idp ได้แล้ว
แม้ว่าจะส่งต่อจาก SP มาที่ IdP ได้ แต่ปัจจุบันยังติดปัญหาเรื่อง Relying Party อยู่ ซึ่งต้องดำเนินการคอนฟิกเพิ่มเติมในขั้นตอนถัดไป

หมายเหตุ หากขั้นตอนนี้ไม่ปรากฏผลลัพธ์ตามที่แสดงไว้ และปรากฏหน้าเว็บที่แจ้งว่า page not found คือหาหน้าเว็บไม่พบ อาจจะเป็นไปได้ว่ามีการกำหนดค่าคอนฟิกไว้ไม่ถูกต้อง ที่พบบ่อยเช่น ไม่ได้ใส่หมายเลขพอร์ต 8443 ไว้ในไฟล์ idp-metadata.xml ให้กลับไปดูที่ขั้นตอนก่อนหน้า และแก้ไขให้ถูกต้อง

ความคิดเห็น

โพสต์ยอดนิยมจากบล็อกนี้

การติดตั้ง Shibboleth Single Sign-On
ตอนที่ 12 - การทำ SLO (Single Log-out)

ตัวอย่างการเข้ารหัส AES ด้วย Java และถอดรหัสด้วย C#.NET

การรักษาความปลอดภัยแบบ OWASP