Skip to content
Snippets Groups Projects
Commit 2bf2f1da authored by Martin Haase's avatar Martin Haase
Browse files

VOMRS AutoRegistration fpr SLCS, PoC

git-svn-id: https://textgridlab.org/svn/textgrid/trunk/middleware/tgauth@6864 7c539038-3410-0410-b1ec-0f2a7bf1c452
parent d389d28f
No related branches found
No related tags found
No related merge requests found
...@@ -135,6 +135,12 @@ The corresponding private key is now held by TG-auth*. This service will be inte ...@@ -135,6 +135,12 @@ The corresponding private key is now held by TG-auth*. This service will be inte
<input type="submit" value="Return to the TextGridLab"/> <input type="submit" value="Return to the TextGridLab"/>
</form><br/> </form><br/>
EOF EOF
registerUserAtVOMRS (
"/usr/local/bin/VOMRSclient/bin/runAutoregClient.sh",
$certificate,
);
print $cgi->end_html(); print $cgi->end_html();
} }
...@@ -152,6 +158,49 @@ sub handleRejected ...@@ -152,6 +158,49 @@ sub handleRejected
# Utility functions # Utility functions
# #
sub registerUserAtVOMRS {
my ($registerScript, $pem) = @_;
use Crypt::OpenSSL::X509;
my $crt = Crypt::OpenSSL::X509->new_from_string ( $pem );
my $dn_commas = $crt->subject();
my $ca_commas = $crt->issuer();
my $mail = $crt->email();
my $serial = $crt->serial();
my ($firstname, $lastname ) = getSLCname ($dn_commas);
my $dn = commas2slashes ($dn_commas);
my $ca = commas2slashes ($ca_commas);
my $phone = "0123456789"; # well, we really don't have it anywhere
system "$registerScript '$dn' '$ca' '$serial' '$mail' '$firstname' '$lastname' '$phone' >/dev/null";
}
# assumes "C=DE, ..., CN=Tanja Test - tanja.test@textgrid-test-idp.de"
# returns ("Tanja", "Test")
sub getSLCname {
my $dn = shift;
$dn =~ /CN=(\S+\s+)+(\S+)\s+-\s+/;
$givennames = $1;
$surname = $2;
$givennames =~ s/\s+$//;
return ( $givennames, $surname );
}
# translates C=DE, O=DFN-Verein, OU=DFN-PKI, CN=DFN-Verein Test-AAI SLCS CA
# to /C=DE/O=DFN-Verein/OU=DFN-PKI/CN=DFN-Verein Test-AAI SLCS CA
sub commas2slashes {
$_ = shift;
s/,\s+/\//g;
return '/' . $_;
}
sub getConfig { sub getConfig {
my ($configfilename, $authZinstance) = @_; my ($configfilename, $authZinstance) = @_;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment