From a188aaa58f173090d07ca8000663fe0888ef9949 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Michael=20Kr=C3=B6ll?= Date: Mon, 1 Dec 2008 23:39:52 +0100 Subject: Take baseurl from config --- lib/PAUSE/OpenID/Controller/Root.pm | 13 +++++++++---- pause_openid.pl | 2 +- pause_openid_local.pl | 2 +- root/templates/index.xsl | 2 +- 4 files changed, 12 insertions(+), 7 deletions(-) diff --git a/lib/PAUSE/OpenID/Controller/Root.pm b/lib/PAUSE/OpenID/Controller/Root.pm index 566a0a1..67d4411 100644 --- a/lib/PAUSE/OpenID/Controller/Root.pm +++ b/lib/PAUSE/OpenID/Controller/Root.pm @@ -31,14 +31,19 @@ PAUSE::OpenID::Controller::Root - Root Controller for PAUSE::OpenID sub index :Path :Args(0) { my ( $self, $c ) = @_; - if ( not defined $c->req->param('openid.return_to') ) { + # 5.2.3 + # If the malformed or invalid message is received by the Relying Party, or "openid.return_to" + # is not present or its value is not a valid URL, the server SHOULD return a response to the end user + # indicating the error and that it is unable to continue. + my $return_to = $c->req->param('openid.return_to'); + # TODO: check if its a valid URL + if ( not defined $return_to ) { #$c->flash->{xml} = 'Missing parameter'; $c->res->redirect($c->uri_for('/error')); } -$c->stash->{xml} =< -XML + # TODO: generate XML programatically + $c->stash->{xml} = sprintf('', $c->config->{'PAUSE::OpenID'}{'baseurl'}); # Pass through parameters (unchecked for now) foreach my $key ( keys %{$c->req->params} ) { diff --git a/pause_openid.pl b/pause_openid.pl index f480b77..c89b092 100644 --- a/pause_openid.pl +++ b/pause_openid.pl @@ -23,7 +23,7 @@ return { }, 'PAUSE::OpenID'=>{ - hostname=>'id.pause.org', + baseurl=>'https://id.pause.org/', }, }; diff --git a/pause_openid_local.pl b/pause_openid_local.pl index b823bbe..0176434 100644 --- a/pause_openid_local.pl +++ b/pause_openid_local.pl @@ -4,7 +4,7 @@ use warnings; # Returnvalue return { 'PAUSE::OpenID'=>{ - hostname=>'localhost', + baseurl=>'http://localhost:3000/', }, }; diff --git a/root/templates/index.xsl b/root/templates/index.xsl index 9dc5bd4..6b83e4b 100644 --- a/root/templates/index.xsl +++ b/root/templates/index.xsl @@ -13,7 +13,7 @@ Sign in with OpenID - + -- cgit v1.2.3 From bc30ecf0065744dcf3702b428031995df619ed2c Mon Sep 17 00:00:00 2001 From: Jozef Kutej Date: Mon, 1 Dec 2008 23:45:33 +0100 Subject: bad bad --- lib/PAUSE/OpenID/Controller/Root.pm | 1 + 1 file changed, 1 insertion(+) diff --git a/lib/PAUSE/OpenID/Controller/Root.pm b/lib/PAUSE/OpenID/Controller/Root.pm index 05135e5..221955f 100644 --- a/lib/PAUSE/OpenID/Controller/Root.pm +++ b/lib/PAUSE/OpenID/Controller/Root.pm @@ -77,6 +77,7 @@ sub login :Local { $ua->credentials('pause.perl.org:443', 'PAUSE', $username, $password); my $res = $ua->request($req); + # but this is bad as the certificate is checked AFTER the credentials are send :-( die 'pause server certificate validation failed' if exists $res->headers->{'client-ssl-warning'}; -- cgit v1.2.3 From b143b0264817e999c40601b32a81901cc7a8ff72 Mon Sep 17 00:00:00 2001 From: Jozef Kutej Date: Mon, 1 Dec 2008 23:52:13 +0100 Subject: page not found content type --- lib/PAUSE/OpenID/Controller/Root.pm | 1 + 1 file changed, 1 insertion(+) diff --git a/lib/PAUSE/OpenID/Controller/Root.pm b/lib/PAUSE/OpenID/Controller/Root.pm index cfbc608..e2b918b 100644 --- a/lib/PAUSE/OpenID/Controller/Root.pm +++ b/lib/PAUSE/OpenID/Controller/Root.pm @@ -62,6 +62,7 @@ sub error :Local { sub default :Path { my ( $self, $c ) = @_; + $c->response->content_type('text/plain'); $c->response->body( 'Page not found' ); $c->response->status(404); -- cgit v1.2.3