diff options
author | Thomas Klausner <domm@cpan.org> | 2008-12-01 23:57:31 +0100 |
---|---|---|
committer | Thomas Klausner <domm@cpan.org> | 2008-12-01 23:57:31 +0100 |
commit | 63bf868c3e356dbd7525f0aaba848b2fff5b808e (patch) | |
tree | a49b9e076b13f6f721a2c7d3411464086e5da070 /lib/PAUSE/OpenID/Controller/Root.pm | |
parent | added rough catch-all action for pauseids (diff) | |
parent | page not found content type (diff) | |
download | Simple-OpenID-63bf868c3e356dbd7525f0aaba848b2fff5b808e.tar.gz Simple-OpenID-63bf868c3e356dbd7525f0aaba848b2fff5b808e.tar.bz2 Simple-OpenID-63bf868c3e356dbd7525f0aaba848b2fff5b808e.zip |
Merge branch 'master' of git@git.useperl.at:PAUSE-OpenID
Diffstat (limited to 'lib/PAUSE/OpenID/Controller/Root.pm')
-rw-r--r-- | lib/PAUSE/OpenID/Controller/Root.pm | 15 |
1 files changed, 11 insertions, 4 deletions
diff --git a/lib/PAUSE/OpenID/Controller/Root.pm b/lib/PAUSE/OpenID/Controller/Root.pm index e0575b8..387429e 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} = '<document><error_message>Missing parameter</error_message></document>'; $c->res->redirect($c->uri_for('/error')); } -$c->stash->{xml} =<<XML; -<document/> -XML + # TODO: generate XML programatically + $c->stash->{xml} = sprintf('<document><config key="url" value="%s"/></document>', $c->config->{'PAUSE::OpenID'}{'baseurl'}); # Pass through parameters (unchecked for now) foreach my $key ( keys %{$c->req->params} ) { @@ -57,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); @@ -77,6 +83,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'}; |