summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rwxr-xr-xscripts/rename-xml.sh67
-rw-r--r--swamid-2.0/indico.fysik.su.se-Shibboleth.sso.xml (renamed from swamid-2.0/indico.fysik.su.se-shibboleth.sso.xml)0
-rw-r--r--swamid-sp-2.0.mxml2
3 files changed, 68 insertions, 1 deletions
diff --git a/scripts/rename-xml.sh b/scripts/rename-xml.sh
new file mode 100755
index 00000000..9ef89ead
--- /dev/null
+++ b/scripts/rename-xml.sh
@@ -0,0 +1,67 @@
+#!/bin/bash
+#
+# Fetch Service Provider metadata and save into entityid filename
+#
+
+error()
+{
+ echo "Error: $*" 1>&2
+ exit 1
+}
+
+entityID=$1
+if [ -z "$entityID" ] ; then
+ cat <<EOF
+Usage: `basename $0` <entityID>
+Ex: `basename $0` https://shibsp.mysite.com/swamidproxy/gitlab.xml
+EOF
+ exit 1
+fi
+
+if [ `uname -s` == "Darwin" ]; then
+ SEDI="sed -i ''"
+else
+ SEDI="sed -i"
+fi
+
+script_cwd=`dirname "$0"`
+if test -d swamid-2.0 ; then
+ echo "Moving into swamid-2.0/"
+ cd swamid-2.0
+ echo "$script_cwd" | grep -q ^/ || script_cwd=../$script_cwd
+fi
+
+if echo "$entityID" | grep -qE '^http://|^https://' ; then
+ metadata=`grep -il "$entityID" *`
+else
+ echo "Missing http(s) in entityID"
+fi
+[ -n "$metadata" ] || error "Failed to fetch metadata from $metadataurl"
+
+entityid=`cat "$metadata" | sed -n 's/.*entityID=['\''"]\([^"]*\)['\''"].*/\1/p'`
+[ -n "$entityid" ] || error "Failed to find entityID in metadata"
+[ `echo "$entityid" | wc -l` = 1 ] || error "Multiple entityid:s found: `echo $entityid`"
+
+entityidfn=`echo "$entityid" | sed 's;https*://;;' | sed 's/[^a-zA-Z0-9_.-]/-/g' | sed 's/$/.xml/'`
+[ -n "$entityidfn" ] || error "Failed to generate filename from entityid $entityid"
+
+[ -r "$entityidfn" ] && new=false || new=true
+if $new ; then
+ echo -n "Move $metadata into $entityidfn [Y/n]? "
+else
+ echo "$entityidfn and $metadata are the same"
+ exit
+fi
+read x
+case $x in
+ Y|y|"")
+ grep -l "$metadata\"" ../*.mxml | while read file; do
+ $SEDI "s;href=\"swamid-2.0/$metadata\";href=\"swamid-2.0/$entityidfn\";" $file
+ done
+ git mv $metadata $entityidfn
+
+ ;;
+ *)
+ echo "Nothing done"
+ ;;
+esac
diff --git a/swamid-2.0/indico.fysik.su.se-shibboleth.sso.xml b/swamid-2.0/indico.fysik.su.se-Shibboleth.sso.xml
index 927fd84c..927fd84c 100644
--- a/swamid-2.0/indico.fysik.su.se-shibboleth.sso.xml
+++ b/swamid-2.0/indico.fysik.su.se-Shibboleth.sso.xml
diff --git a/swamid-sp-2.0.mxml b/swamid-sp-2.0.mxml
index 70db83ca..0804c1f6 100644
--- a/swamid-sp-2.0.mxml
+++ b/swamid-sp-2.0.mxml
@@ -629,7 +629,7 @@
<xi:include href="swamid-2.0/disp-test.su.se-shibboleth.sso.xml"/>
<xi:include href="swamid-2.0/gss-su.nextcloud.dev.safedc.services-apps-user_saml-saml-metadata.xml"/>
<xi:include href="swamid-2.0/artisan-idp-proxy.sunet.se-sp.xml"/>
- <xi:include href="swamid-2.0/indico.fysik.su.se-shibboleth.sso.xml"/>
+ <xi:include href="swamid-2.0/indico.fysik.su.se-Shibboleth.sso.xml"/>
<xi:include href="swamid-2.0/nextcloud.fysik.su.se-apps-user_saml-saml-metadata.xml"/>
<xi:include href="swamid-2.0/nextcloud.fysik.su.se-swamidproxy-nextcloud.xml.xml"/>
<xi:include href="swamid-2.0/lists-test.its.uu.se-shibboleth.xml"/>