aboutsummaryrefslogtreecommitdiffstats
path: root/perllib/FixMyStreet
diff options
context:
space:
mode:
Diffstat (limited to 'perllib/FixMyStreet')
-rw-r--r--perllib/FixMyStreet/App.pm13
-rw-r--r--perllib/FixMyStreet/App/Controller/Auth.pm2
2 files changed, 15 insertions, 0 deletions
diff --git a/perllib/FixMyStreet/App.pm b/perllib/FixMyStreet/App.pm
index 1eb197e38..e47336b7c 100644
--- a/perllib/FixMyStreet/App.pm
+++ b/perllib/FixMyStreet/App.pm
@@ -81,6 +81,19 @@ __PACKAGE__->config(
user_model => 'DB::User',
},
},
+ access_token => {
+ use_session => 0,
+ credential => {
+ class => 'AccessToken',
+ token_field => 'extra',
+ # This means the token has to be 18 characters long (as generated by AuthToken)
+ token_lookup => { like => "%access_token,T18:TOKEN,%" },
+ },
+ store => {
+ class => 'DBIx::Class',
+ user_model => 'DB::User',
+ },
+ },
},
);
diff --git a/perllib/FixMyStreet/App/Controller/Auth.pm b/perllib/FixMyStreet/App/Controller/Auth.pm
index 80e407147..455022e03 100644
--- a/perllib/FixMyStreet/App/Controller/Auth.pm
+++ b/perllib/FixMyStreet/App/Controller/Auth.pm
@@ -419,6 +419,8 @@ Mainly intended for testing but might also be useful for ajax calls.
sub check_auth : Local {
my ( $self, $c ) = @_;
+ $c->authenticate(undef, 'access_token') unless $c->user;
+
# choose the response
my ( $body, $code ) #
= $c->user