Catalyst::ActionRole::NoSSL - Force an action to be plain.


Catalyst-ActionRole-RequireSSL documentation Contained in the Catalyst-ActionRole-RequireSSL distribution.

Index


Code Index:

NAME

Top

Catalyst::ActionRole::NoSSL - Force an action to be plain.

VERSION

Top

version 0.06

SYNOPSIS

Top

  package MyApp::Controller::Foo;

  use parent qw/Catalyst::Controller::ActionRole/;

  sub bar : Local Does('RequireSSL') { ... }
  sub bar : Local Does('NoSSL') { ... }

AUTHOR

Top

Simon Elliott <cpan@papercreatures.com>

THANKS

Top

Andy Grundman, <andy@hybridized.org> for the original RequireSSL Plugin

t0m (Tomas Doran), zamolxes (Bogdan Lucaciu)

COPYRIGHT & LICENSE

Top


Catalyst-ActionRole-RequireSSL documentation Contained in the Catalyst-ActionRole-RequireSSL distribution.

package  Catalyst::ActionRole::NoSSL;

use Moose::Role;
with 'Catalyst::ActionRole::RequireSSL::Role';
use namespace::autoclean;
our $VERSION = '0.06';

around execute => sub {
  my $orig = shift;
  my $self = shift;
  my ($controller, $c) = @_;

  if($c->req->secure && $self->check_chain($c) &&
    ( $c->req->method ne "POST" || 
      $c->config->{require_ssl}->{ignore_on_post} )) {
    my $uri = $c->req->uri;
    $uri->scheme('http');
    $c->res->redirect( $uri );
    $c->detach();
  } else {
    $self->$orig( @_ );
  }
};

1;