Skip to content

Commit

Permalink
add separate secure external api config, and use it for oauth
Browse files Browse the repository at this point in the history
  • Loading branch information
haarg committed Mar 3, 2014
1 parent b0062d5 commit ff44f3b
Show file tree
Hide file tree
Showing 5 changed files with 9 additions and 3 deletions.
5 changes: 5 additions & 0 deletions lib/MetaCPAN/Web/Controller/Root.pm
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -87,6 +87,11 @@ sub end : ActionClass('RenderView') {
$c->stash->{api_secure} = $c->config->{api_secure} || $c->config->{api}; $c->stash->{api_secure} = $c->config->{api_secure} || $c->config->{api};
$c->stash->{api_external} $c->stash->{api_external}
= $c->config->{api_external} || $c->config->{api}; = $c->config->{api_external} || $c->config->{api};
$c->stash->{api_external_secure}
= $c->config->{api_external_secure} || $c->config->{api_external}
|| $c->stash->{api_secure};
$c->stash->{oauth_prefix} = $c->stash->{api_external_secure}
. '/oauth2/authorize?client_id=' . $c->config->{consumer_key};
$c->res->header( Vary => 'Cookie' ); $c->res->header( Vary => 'Cookie' );


unless ( unless (
Expand Down
1 change: 1 addition & 0 deletions metacpan_web.conf
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ default_view HTML
api = http://api.metacpan.org api = http://api.metacpan.org
api_external = http://api.metacpan.org api_external = http://api.metacpan.org
api_secure = https://api.metacpan.org api_secure = https://api.metacpan.org
api_external_secure = https://api.metacpan.org
consumer_key = metacpan.dev consumer_key = metacpan.dev
consumer_secret = ClearAirTurbulence consumer_secret = ClearAirTurbulence


Expand Down
2 changes: 1 addition & 1 deletion root/account/identities.html
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ <h4 class="alert-heading">Information</h4>
<button type="submit" class="btn btn-block btn-danger"><i class="icon-remove icon-white"></i> Disconnect</a> <button type="submit" class="btn btn-block btn-danger"><i class="icon-remove icon-white"></i> Disconnect</a>
</form> </form>
<%- ELSE %> <%- ELSE %>
<a class="btn btn-block btn-success" href="<% api_secure %>/oauth2/authorize?choice=<% identity.lower %>&amp;client_id=<% c.config.consumer_key %>" onclick="return logInPAUSE(this)"><i class="icon-share icon-white"></i> Connect</a> <a class="btn btn-block btn-success" href="<% oauth_prefix %>&amp;choice=<% identity.lower %>" onclick="return logInPAUSE(this)"><i class="icon-share icon-white"></i> Connect</a>
<%- END %> <%- END %>
</td> </td>
</tr> </tr>
Expand Down
2 changes: 1 addition & 1 deletion root/account/profile.html
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
<% IF no_profile -%> <% IF no_profile -%>
<div class="alert alert-error"> <div class="alert alert-error">
<h4 class="alert-heading">Error</h4> <h4 class="alert-heading">Error</h4>
In order to change your profile you have to <a href="<% api_secure %>/oauth2/authorize?choice=pause&amp;client_id=<% c.config.consumer_key %>" onclick="return logInPAUSE(this)">connect your account to PAUSE</a>. In order to change your profile you have to <a href="<% oauth_prefix %>&amp;choice=pause" onclick="return logInPAUSE(this)">connect your account to PAUSE</a>.
</div> </div>
<% ELSE -%> <% ELSE -%>
<form method="POST" action="" class="form-horizontal"> <form method="POST" action="" class="form-horizontal">
Expand Down
2 changes: 1 addition & 1 deletion root/wrapper.html
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@
<ul class="dropdown-menu"> <ul class="dropdown-menu">
<%- FOREACH identity IN ['Facebook', 'GitHub', 'Twitter', 'Google'] %> <%- FOREACH identity IN ['Facebook', 'GitHub', 'Twitter', 'Google'] %>
<li> <li>
<a href="<% api_secure %>/oauth2/authorize?choice=<% identity.lower %>&amp;client_id=<% c.config.consumer_key %>" onclick="return logInPAUSE(this)"><% identity %></a> <a href="<% oauth_prefix %>&amp;choice=<% identity.lower %>" onclick="return logInPAUSE(this)"><% identity %></a>
</li> </li>
<%- END %> <%- END %>
</ul> </ul>
Expand Down

0 comments on commit ff44f3b

Please sign in to comment.