12 SAML10PROT="urn:oasis:names:tc:SAML:1.0:protocol"
13 SAML11PROT="urn:oasis:names:tc:SAML:1.1:protocol"
14 SAML20PROT="urn:oasis:names:tc:SAML:2.0:protocol"
16 SAML20SOAP="urn:oasis:names:tc:SAML:2.0:bindings:SOAP"
17 SAML20REDIRECT="urn:oasis:names:tc:SAML:2.0:bindings:HTTP-Redirect"
18 SAML20POST="urn:oasis:names:tc:SAML:2.0:bindings:HTTP-POST"
19 SAML20POSTSS="urn:oasis:names:tc:SAML:2.0:bindings:HTTP-POST-SimpleSign"
20 SAML20ART="urn:oasis:names:tc:SAML:2.0:bindings:HTTP-Artifact"
21 SAML20PAOS="urn:oasis:names:tc:SAML:2.0:bindings:PAOS"
23 SAML1POST="urn:oasis:names:tc:SAML:1.0:profiles:browser-post"
24 SAML1ART="urn:oasis:names:tc:SAML:1.0:profiles:artifact-01"
26 while getopts a:c:e:f:h:n:o:s:t:u:12ADLNO c
29 c) CERTS[${#CERTS[*]}]=$OPTARG;;
31 f) FORMATS[${#FORMATS[*]}]=$OPTARG;;
32 h) HOSTS[${#HOSTS[*]}]=$OPTARG;;
33 n) NAKEDHOSTS[${#NAKEDHOSTS[*]}]=$OPTARG;;
35 a) ADMIN[${#ADMIN[*]}]=$OPTARG;;
36 s) SUP[${#SUP[*]}]=$OPTARG;;
37 t) TECH[${#TECH[*]}]=$OPTARG;;
46 \?) echo metagen [-12ADLNO] -c cert1 [-c cert2 ...] -h host1 [-h host2 ...] [-e entityID]
51 if [ ${#HOSTS[*]} -eq 0 -a ${#NAKEDHOSTS[*]} -eq 0 ] ; then
52 echo metagen [-12ADLN] -c cert1 [-c cert2 ...] -h host1 [-h host2 ...] [-e entityID]
56 if [ ${#CERTS[*]} -eq 0 ] ; then
57 CERTS[${#CERTS[*]}]=sp-cert.pem
63 echo Certificate file $c does not exist!
68 if [ -z $ENTITYID ] ; then
69 if [ ${#HOSTS[*]} -eq 0 ] ; then
70 ENTITYID=https://${NAKEDHOSTS[0]}/shibboleth
72 ENTITYID=https://${HOSTS[0]}/shibboleth
76 # Establish protocols and bindings.
78 if [ $SAML1 -eq 0 -a $SAML2 -eq 0 ] ; then
83 if [ $LOGOUT -eq 1 -o $NAMEIDMGMT -eq 1 ] ; then
85 SLO[${#SLO[*]}]=$SAML20SOAP
86 SLO[${#SLO[*]}]=$SAML20REDIRECT
87 SLO[${#SLO[*]}]=$SAML20POST
88 SLOLOC[${#SLOLOC[*]}]="SOAP"
89 SLOLOC[${#SLOLOC[*]}]="Redirect"
90 SLOLOC[${#SLOLOC[*]}]="POST"
91 if [ $ARTIFACT -eq 1 ] ; then
92 SLO[${#SLO[*]}]=$SAML20ART
93 SLOLOC[${#SLOLOC[*]}]="Artifact"
97 if [ $SAML1 -eq 1 -a $SAML2 -eq 1 ] ; then
98 PROTENUM="$SAML20PROT $SAML11PROT"
99 elif [ $SAML1 -eq 1 ] ; then
100 PROTENUM="$SAML11PROT"
102 PROTENUM="$SAML20PROT"
105 if [ $SAML2 -eq 1 ] ; then
106 ACS[${#ACS[*]}]=$SAML20POST
107 ACSLOC[${#ACSLOC[*]}]="SAML2/POST"
108 ACS[${#ACS[*]}]=$SAML20POSTSS
109 ACSLOC[${#ACSLOC[*]}]="SAML2/POST-SimpleSign"
110 if [ $ARTIFACT -eq 1 ] ; then
111 ACS[${#ACS[*]}]=$SAML20ART
112 ACSLOC[${#ACSLOC[*]}]="SAML2/Artifact"
114 ACS[${#ACS[*]}]=$SAML20PAOS
115 ACSLOC[${#ACSLOC[*]}]="SAML2/ECP"
118 if [ $SAML1 -eq 1 ] ; then
119 ACS[${#ACS[*]}]=$SAML1POST
120 ACSLOC[${#ACSLOC[*]}]="SAML/POST"
121 if [ $ARTIFACT -eq 1 ] ; then
122 ACS[${#ACS[*]}]=$SAML1ART
123 ACSLOC[${#ACSLOC[*]}]="SAML/Artifact"
127 if [ $DECLS -eq 1 ] ; then
128 DECLS="xmlns:md=\"urn:oasis:names:tc:SAML:2.0:metadata\" xmlns:ds=\"http://www.w3.org/2000/09/xmldsig#\" "
129 if [ $DS -eq 1 ] ; then
130 DECLS="${DECLS}xmlns:disco=\"urn:oasis:names:tc:SAML:profiles:SSO:idp-discovery-protocol\" "
137 <md:EntityDescriptor ${DECLS}entityID="${ENTITYID}">
138 <md:SPSSODescriptor protocolSupportEnumeration="${PROTENUM}">
142 if [ $DS -eq 1 ] ; then
152 <disco:DiscoveryResponse Binding="urn:oasis:names:tc:SAML:profiles:SSO:idp-discovery-protocol" Location="https://$h/Shibboleth.sso/DS" index="$count"/>
157 for h in ${NAKEDHOSTS[@]}
160 <disco:DiscoveryResponse Binding="urn:oasis:names:tc:SAML:profiles:SSO:idp-discovery-protocol" Location="http://$h/Shibboleth.sso/DS" index="$count"/>
182 </ds:X509Certificate>
189 for f in ${FORMATS[@]}
192 <md:NameIDFormat>$f</md:NameIDFormat>
197 if [ $LOGOUT -eq 1 ] ; then
202 while [ $count -lt ${#SLO[*]} ]
205 <md:SingleLogoutService Binding="${SLO[$count]}" Location="https://$h/Shibboleth.sso/SLO/${SLOLOC[$count]}"/>
211 for h in ${NAKEDHOSTS[@]}
214 while [ $count -lt ${#SLO[*]} ]
217 <md:SingleLogoutService Binding="${SLO[$count]}" Location="http://$h/Shibboleth.sso/SLO/${SLOLOC[$count]}"/>
227 if [ $NAMEIDMGMT -eq 1 ] ; then
232 while [ $count -lt ${#SLO[*]} ]
235 <md:ManageNameIDService Binding="${SLO[$count]}" Location="https://$h/Shibboleth.sso/NIM/${SLOLOC[$count]}"/>
241 for h in ${NAKEDHOSTS[@]}
244 while [ $count -lt ${#SLO[*]} ]
247 <md:ManageNameIDService Binding="${SLO[$count]}" Location="http://$h/Shibboleth.sso/NIM/${SLOLOC[$count]}"/>
260 while [ $count -lt ${#ACS[*]} ]
263 <md:AssertionConsumerService Binding="${ACS[$count]}" Location="https://$h/Shibboleth.sso/${ACSLOC[$count]}" index="$((index+1))"/>
270 for h in ${NAKEDHOSTS[@]}
273 while [ $count -lt ${#ACS[*]} ]
276 <md:AssertionConsumerService Binding="${ACS[$count]}" Location="http://$h/Shibboleth.sso/${ACSLOC[$count]}" index="$((index+1))"/>
284 </md:SPSSODescriptor>
287 if [ -n "$ORGNAME" ] ; then
288 if [ -z "$URL" ] ; then
293 <md:OrganizationName xml:lang="en">$ORGNAME</md:OrganizationName>
294 <md:OrganizationDisplayName xml:lang="en">$ORGNAME</md:OrganizationDisplayName>
295 <md:OrganizationURL xml:lang="en">$URL</md:OrganizationURL>
301 for (( i=0; i<count; i++ ))
303 IFS="/"; declare -a c=(${ADMIN[$i]})
305 <md:ContactPerson contactType="administrative">
306 <md:GivenName>${c[0]}</md:GivenName>
307 <md:SurName>${c[1]}</md:SurName>
308 <md:EmailAddress>${c[2]}</md:EmailAddress>
314 for (( i=0; i<count; i++ ))
316 IFS="/"; declare -a c=(${SUP[$i]})
318 <md:ContactPerson contactType="support">
319 <md:GivenName>${c[0]}</md:GivenName>
320 <md:SurName>${c[1]}</md:SurName>
321 <md:EmailAddress>${c[2]}</md:EmailAddress>
327 for (( i=0; i<count; i++ ))
329 IFS="/"; declare -a c=(${TECH[$i]})
331 <md:ContactPerson contactType="technical">
332 <md:GivenName>${c[0]}</md:GivenName>
333 <md:SurName>${c[1]}</md:SurName>
334 <md:EmailAddress>${c[2]}</md:EmailAddress>
340 </md:EntityDescriptor>