From: Alexander Hartmaier Date: Tue, 24 Nov 2015 14:53:17 +0000 (+0100) Subject: validate persist_in_session on store creation X-Git-Tag: v1.016~1^2~11 X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?p=catagits%2FCatalyst-Authentication-Store-LDAP.git;a=commitdiff_plain;h=4f7db8318864b1f895f08e25b5fa307887cc976f validate persist_in_session on store creation to prevent typos from changing expected behaviour --- diff --git a/lib/Catalyst/Authentication/Store/LDAP/Backend.pm b/lib/Catalyst/Authentication/Store/LDAP/Backend.pm index 90b170e..605561d 100644 --- a/lib/Catalyst/Authentication/Store/LDAP/Backend.pm +++ b/lib/Catalyst/Authentication/Store/LDAP/Backend.pm @@ -127,6 +127,8 @@ sub new { ||= 'Catalyst::Authentication::Store::LDAP::User'; $config_hash{'role_search_as_user'} ||= 0; $config_hash{'persist_in_session'} ||= 'username'; + Catalyst::Exception->throw('persist_in_session must be either username or all') + unless $config_hash{'persist_in_session'} =~ /\A(?:username|all)\z/; Catalyst::Utils::ensure_class_loaded( $config_hash{'user_class'} ); my $self = \%config_hash;