Try::Tiny used so we can catch a detach from the like of Credential::HTTP as per...
[catagits/Catalyst-Plugin-Authentication.git] / t / lib / RemoteTestApp2.pm
index 6aa2675..1ec5185 100644 (file)
@@ -1,11 +1,15 @@
 package RemoteTestApp2;
+use strict;
+use warnings;
 
 use Catalyst qw/
    Authentication
 /;
 
 use base qw/Catalyst/;
-__PACKAGE__->engine_class('RemoteTestEngine');
+unless ($Catalyst::VERSION >= 5.89000) {
+    __PACKAGE__->engine_class('RemoteTestEngine');
+}
 __PACKAGE__->config(
     'Plugin::Authentication' => {
         default_realm => 'remote',
@@ -26,25 +30,11 @@ __PACKAGE__->config(
         },
     },
 );
-
-sub default : Local {
-    my ( $self, $c ) = @_;
-    if ($c->authenticate()) {
-        $c->res->body( 
-              'my_user_name:'
-              . $c->user->{my_user_name}
-        );
-    }
-    else {
-        $c->res->body('FAIL');
-        $c->res->status(403);
-    }
-}
-
-sub public : Local {
-    my ( $self, $c ) = @_;
-    $c->res->body('OK');
+__PACKAGE__->setup;
+if ($Catalyst::VERSION >= 5.89000) {
+    require RemoteTestEngineRole;
+    RemoteTestEngineRole->meta->apply(__PACKAGE__->engine);
 }
 
-__PACKAGE__->setup;
+1;