Changeset 15796 for lang/perl/Apache2-AuthenOpenID
- Timestamp:
- 07/14/08 18:19:06 (4 months ago)
- Files:
-
- 1 modified
Legend:
- Unmodified
- Added
- Removed
-
lang/perl/Apache2-AuthenOpenID/branches/per_dir_config/lib/Apache2/AuthenOpenID.pm
r11424 r15796 60 60 sub return_to { 61 61 my ($self, $params, $arg) = @_; 62 my $class = ref $self; 63 my $i = Apache2::Module::get_config($class, $params->server); 64 $i->{'return_to'} = $arg; 62 $self->{'return_to'} = $arg; 65 63 } 66 64 67 65 sub trust_root { 68 66 my ($self, $params, $arg) = @_; 69 my $class = ref $self; 70 my $i = Apache2::Module::get_config($class, $params->server); 71 $i->{'trust_root'} = $arg; 67 $self->{'trust_root'} = $arg; 72 68 } 73 69 74 70 sub consumer_secret { 75 71 my ($self, $params, $arg) = @_; 76 my $class = ref $self; 77 my $i = Apache2::Module::get_config($class, $params->server); 78 $i->{'consumer_secret'} = $arg; 72 $self->{'consumer_secret'} = $arg; 79 73 } 80 74 … … 82 76 my ($self, $r) = @_; 83 77 lc $r->auth_type eq lc $self->auth_type or return Apache2::Const::DECLINED; 84 my $cf = Apache2::Module::get_config($self, $r->server); 78 79 my $cf = Apache2::Module::get_config($self, $r->server, $r->per_dir_config); 80 $r->log->debug( 81 sprintf "tr=%s rt=%s cs=%s", $cf->{'trust_root'}, $cf->{'return_to'}, $cf->{'consumer_secret'} 82 ); 85 83 unless ($cf->{'trust_root'} && $cf->{'return_to'} && $cf->{'consumer_secret'}) { 86 84 $r->log_error("You need to specify trust_root, return_to, and consumer_secret."); … … 110 108 ); 111 109 if ($request_url eq $cf->{'return_to'}) { 110 $r->log->debug("$request_url is return_to"); 112 111 if (my $identity = $q->param('identity')) { 113 112 my $claimed_identity = $csr->claimed_identity($identity) … … 117 116 trust_root => $cf->{'trust_root'}, 118 117 ); 118 $r->log->debug("clamed_identity=$claimed_identity check_url=$check_url"); 119 119 $r->err_headers_out->set(Location => $check_url); 120 120 return Apache2::Const::REDIRECT; 121 121 } elsif (my $setup_url = $csr->user_setup_url) { 122 $r->log->debug("setup_url=$setup_url"); 122 123 $r->err_headers_out->set(Location => $setup_url); 123 124 return Apache2::Const::REDIRECT; 124 125 } elsif ($csr->user_cancel) { 126 $r->log->debug("user_canceled."); 125 127 return Apache2::Const::HTTP_UNAUTHORIZED; 126 128 } elsif (my $vident = $csr->verified_identity) { 129 $r->log->debug('verified_identity'); 127 130 my $url = $vident->url; 128 131 $url =~ s{(^https?://|/$)}{}g; … … 136 139 if (%cookie_in && (my $dest = $cookie_in{$cookie_dest_name})) { 137 140 $r->headers_out->set('Location' => $dest->value); 141 $r->log->debug('return to cookie_dest='. $dest->value); 138 142 } else { 139 143 $r->headers_out->set('Location' => $cf->{'trust_root'}); 144 $r->log->debug('redirect to trust_root'); 140 145 } 141 146 my $cookie_dest_erase = CGI::Cookie->new( … … 148 153 return Apache2::Const::REDIRECT; 149 154 } 155 156 $r->log_error("Error validating identity: " . $csr->err); 150 157 return Apache2::Const::HTTP_UNAUTHORIZED; 151 158 } … … 170 177 sub set_custom_response { 171 178 my ($self, $r) = @_; 172 my $cf = Apache2::Module::get_config($self, $r->server );179 my $cf = Apache2::Module::get_config($self, $r->server, $r->per_dir_config); 173 180 my $auth_name = $r->auth_name; 174 181 my $html = <<END;
![(please configure the [header_logo] section in trac.ini)](/share/chrome/site/your_project_logo.png)