OpenPKG CVS Repository
http://cvs.openpkg.org/
____________________________________________________________________________
Server: cvs.openpkg.org Name: Thomas Lotterer
Root: /v/openpkg/cvs Email: [EMAIL PROTECTED]
Module: openpkg-registry Date: 24-Nov-2005 12:22:31
Branch: HEAD Handle: 2005112411223100
Modified files:
openpkg-registry registry-ui.pl
Log:
use OSSP ase
Summary:
Revision Changes Path
1.10 +80 -6 openpkg-registry/registry-ui.pl
____________________________________________________________________________
patch -p0 <<'@@ .'
Index: openpkg-registry/registry-ui.pl
============================================================================
$ cvs diff -u -r1.9 -r1.10 registry-ui.pl
--- openpkg-registry/registry-ui.pl 24 Nov 2005 11:21:56 -0000 1.9
+++ openpkg-registry/registry-ui.pl 24 Nov 2005 11:22:31 -0000 1.10
@@ -35,6 +35,8 @@
use DBD::Pg;
use MIME::Base64;
use XML::Simple;
+#use OSSP::ase::client; # FIXME production
+BEGIN { require "./ase.pm"; import OSSP::ase::client; } # FIXME development
# configure optional debugging
$Data::Dumper::Purity = 1;
@@ -61,7 +63,7 @@
# basicauth - believe in webserver's basic authentication
# ase - OSSP affiliation services environment
#
-$cfg->{identification}->{mode} = "basicauth";
+$cfg->{identification}->{mode} = "ase";
$cfg->{identification}->{default} = "[EMAIL PROTECTED]"; #anonymous
$cfg->{db}->{registry}->{username}="registry";
$cfg->{db}->{registry}->{password}="registry";
@@ -170,6 +172,33 @@
CGI::Session->find(sub {});
}
+# establish ASE object
+#
+my $ase;
+$ase = undef;
+my $ase = new OSSP::ase::client(
+ -server => "http://registry.openpkg.org/ase",
+ -cgi => $cgi,
+ -mode => "page",
+ -session => $session,
+);
+if (not defined $ase) {
+ &printprettyerror("Affiliation Services Environment", "");
+ goto CUS;
+}
+
+# give it a chance to run
+#
+if ($ase->responsible()) {
+ if($ase->action()) {
+ print $ase->response();
+ }
+ else {
+ &printprettyerror("Affiliation Services Environment", $ase->error());
+ }
+ goto CUS;
+}
+
# continue to the pages that require database access
#
if ($cgi->param("page") eq "login") {
@@ -219,6 +248,15 @@
$out .= &viewdropxml();
print STDOUT $out;
}
+elsif ($cgi->param("page") eq "ase") {
+ my $out;
+ $out = '';
+ $out .= &viewhttp();
+ $out .= &viewhtmlhead();
+ $out .= &viewase();
+ $out .= &viewhtmltail();
+ print STDOUT $out;
+}
else {
my $out;
$out = '';
@@ -237,6 +275,7 @@
# die gracefully ;-)
#
CUS:
+undef $ase;
undef $session;
undef $cgi;
undef $dbh;
@@ -820,8 +859,20 @@
{
my $html;
$html .= '';
- if ($cfg->{identification}->{mode} eq "ase") {
- die #FIXME
+ if ($cfg->{identification}->{mode} eq "ase-FIXME") {
+ $html .= "<a href=\"";
+ $html .= $ase->url(-action => "login", -mode_during => "ase",
-mode_after => "ase");
+ $html .= "\">Login</a> ";
+ }
+ elsif ($cfg->{identification}->{mode} eq "ase") {
+ $html .= $cgi->start_form(-action => $ase->url(-action => "login",
-mode_during => "ase", -mode_after => "ase"));
+ $html .= $cgi->delete(-name=>'page');
+ $html .= $cgi->hidden(-name=>'page', -value => "ase");
+ $html .= $cgi->hidden(-name=>'ase-action', -value => "login");
+ $html .= $cgi->hidden(-name=>'ase-mode_during', -value => "ase");
+ $html .= $cgi->hidden(-name=>'ase-mode_after', -value =>
"association");
+ $html .= $cgi->submit('submit','login');
+ $html .= $cgi->end_form;
}
elsif ($cfg->{identification}->{mode} eq "basicauth") {
# nop
@@ -849,6 +900,17 @@
return $html;
}
+sub viewase() #FIXME
+{
+ my $html;
+ $html .= '';
+ $html .= "<h1>OSSP ase client at OpenPKG Registry</h1>";
+ $html .= "ASE Login=".$ase->login()."<br>\n";
+ $html .= sprintf("Session: SID %s<br>\n", $session->id());
+ $html .= "<h2>ase</h2><pre>".Dumper($ase)."</pre>\n";
+ return $html;
+}
+
sub printprettyerror($$)
{
my ($marketingmessage, $technicaldetail) = @_;
@@ -911,8 +973,20 @@
{
my $html;
$html = '';
- if ($cfg->{identification}->{mode} eq "ase") {
- die #FIXME
+ if ($cfg->{identification}->{mode} eq "ase-FIXME") {
+ $html .= "<a href=\"";
+ $html .= $ase->url(-action => "logout", -mode_during => "ase",
-mode_after => "ase");
+ $html .= "\">Logout</a> ";
+ }
+ elsif ($cfg->{identification}->{mode} eq "ase") {
+ $html .= $cgi->start_form(-action => $ase->url(-action => "logout",
-mode_during => "ase", -mode_after => "ase"));
+ $html .= $cgi->delete(-name=>'page');
+ $html .= $cgi->hidden(-name=>'page', -value => "ase");
+ $html .= $cgi->hidden(-name=>'ase-action', -value => "logout");
+ $html .= $cgi->hidden(-name=>'ase-mode_during', -value => "ase");
+ $html .= $cgi->hidden(-name=>'ase-mode_after', -value => "dropxml");
+ $html .= $cgi->submit('submit','logout');
+ $html .= $cgi->end_form;
}
elsif ($cfg->{identification}->{mode} eq "basicauth") {
# nop
@@ -1483,7 +1557,7 @@
$username = undef;
if ($cfg->{identification}->{mode} eq "ase") {
- die "FIXME ase not implemented";
+ $username = $ase->attr("client-login-name") if ($ase->login);
}
elsif ($cfg->{identification}->{mode} eq "basicauth") {
$username = $ENV{'REMOTE_USER'};
@@ .
______________________________________________________________________
The OpenPKG Project www.openpkg.org
CVS Repository Commit List [email protected]