Skip to content

Commit

Permalink
Prototype script to verify entity IDs against known registries. Final…
Browse files Browse the repository at this point in the history
… version needs to use the public suffix list.
  • Loading branch information
iay committed Apr 12, 2011
1 parent da5766f commit c83ef18
Showing 1 changed file with 64 additions and 0 deletions.
64 changes: 64 additions & 0 deletions attic/sift_entityids.pl
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
#!/usr/bin/perl

@registries = (
# gTLDs
'.com',
'.edu',
'.net',
'.org',
'.info',

# ccTLDs which allow top-level registration
'.es',
'.eu',
'.nl',
'.tv',

# ccTLD: cn
'.edu.cn',

# ccTLD: jp
'.ac.jp',

# ccTLD: my
'.edu.my',

# CC TLD: uk
'.ac.uk',
'.bl.uk',
'.co.uk',
'.gov.uk',
'.org.uk',
'.parliament.uk',
);

LINE: while (<>) {
chop;

#
# Extract a domain from the entityID
#
if (/^https?:\/\/([^\:\/]+)/) {
$domain = $1;
} elsif (/^urn:mace:ac.uk:sdss.ac.uk:provider:(service|identity):([^:]+)/) {
$domain = $2;
} elsif (/^urn:mace:eduserv.org.uk:athens:federation:(uk|beta)$/) {
$domain = 'eduserv.org.uk';
} elsif (/^urn:mace:eduserv.org.uk:athens:provider:(.*)/) {
$domain = $1;
} else {
print "*** can't extract domain from $_\n";
next;
}

#
# Now figure out the registrar involved with this domain.
#
foreach $registry (@registries) {
if (substr($domain, -length($registry)) eq $registry) {
# print "$domain matched $registry\n";
next LINE;
}
}
print "*** no registry match for $domain\n";
}

0 comments on commit c83ef18

Please sign in to comment.