Mercurial > pub > Impl
diff Lib/Engine/Security.pm @ 49:16ada169ca75
migrating to the Eclipse IDE
author | wizard@linux-odin.local |
---|---|
date | Fri, 26 Feb 2010 10:49:21 +0300 |
parents | 03e58a454b20 |
children |
line wrap: on
line diff
--- a/Lib/Engine/Security.pm Fri Feb 26 01:43:42 2010 +0300 +++ b/Lib/Engine/Security.pm Fri Feb 26 10:49:21 2010 +0300 @@ -1,36 +1,36 @@ -use strict; -package Engine::Security; -use Security::Auth; -use Security; -use Engine::Security::Auth; - -our @AuthMethods; -my $AuthResult; -my $AuthMod; -my $AuthMethod; - -# use last auth method as default -$AuthMethod = Engine::Security::Auth->new(%{$AuthMethods[$#AuthMethods]}) if @AuthMethods; - -sub AuthenticateContext { - Security->CurrentSession(undef); #prevent previous session from closing - foreach my $method (@AuthMethods) { - my $AuthObj = Engine::Security::Auth->new(%$method); - $AuthResult = $AuthObj->DoAuth(); - # обновить текущий контекст безопасности, только если это необходимо - $AuthObj->SetAuthResult($AuthResult) if $AuthResult->State == Security::AUTH_FAILED or $AuthResult->State == Security::AUTH_SUCCESS; - $AuthMethod = $AuthObj and last if $AuthResult->State != Security::AUTH_FAILED and $AuthResult->State != Security::AUTH_NOAUTH; - } - $AuthMod = $AuthMethod->AuthMod if $AuthMethod; -} - -sub SetAuthResult { - shift; - $AuthMethod->SetAuthResult(@_) if $AuthMethod; -} - -sub AuthMod { - return $AuthMethod ? $AuthMethod->AuthMod : undef; -} - -1; \ No newline at end of file +use strict; +package Engine::Security; +use Security::Auth; +use Security; +use Engine::Security::Auth; + +our @AuthMethods; +my $AuthResult; +my $AuthMod; +my $AuthMethod; + +# use last auth method as default +$AuthMethod = Engine::Security::Auth->new(%{$AuthMethods[$#AuthMethods]}) if @AuthMethods; + +sub AuthenticateContext { + Security->CurrentSession(undef); #prevent previous session from closing + foreach my $method (@AuthMethods) { + my $AuthObj = Engine::Security::Auth->new(%$method); + $AuthResult = $AuthObj->DoAuth(); + # обновить текущий контекст безопасности, только если это необходимо + $AuthObj->SetAuthResult($AuthResult) if $AuthResult->State == Security::AUTH_FAILED or $AuthResult->State == Security::AUTH_SUCCESS; + $AuthMethod = $AuthObj and last if $AuthResult->State != Security::AUTH_FAILED and $AuthResult->State != Security::AUTH_NOAUTH; + } + $AuthMod = $AuthMethod->AuthMod if $AuthMethod; +} + +sub SetAuthResult { + shift; + $AuthMethod->SetAuthResult(@_) if $AuthMethod; +} + +sub AuthMod { + return $AuthMethod ? $AuthMethod->AuthMod : undef; +} + +1;