Mercurial > pub > Impl
diff Lib/IMPL/Security/Auth/Simple.pm @ 194:4d0e1962161c
Replaced tabs with spaces
IMPL::Web::View - fixed document model, new features (control classes, document constructor parameters)
author | cin |
---|---|
date | Tue, 10 Apr 2012 20:08:29 +0400 |
parents | d1676be8afcc |
children | 6d8092d8ce1b |
line wrap: on
line diff
--- a/Lib/IMPL/Security/Auth/Simple.pm Tue Apr 10 08:13:22 2012 +0400 +++ b/Lib/IMPL/Security/Auth/Simple.pm Tue Apr 10 20:08:29 2012 +0400 @@ -7,68 +7,68 @@ use IMPL::Class::Property; use IMPL::Security::Auth qw(:Const); -BEGIN { - private property _passwordImage => prop_all; - private property _sessionCookie => prop_all; +BEGIN { + private property _passwordImage => prop_all; + private property _sessionCookie => prop_all; } sub CTOR { - my ($this,$secData) = @_; - - my ($passImg,$cookie) = split /\|/,$secData; - - $this->_passwordImage($passImg); - $this->_sessionCookie($cookie); + my ($this,$secData) = @_; + + my ($passImg,$cookie) = split /\|/,$secData; + + $this->_passwordImage($passImg); + $this->_sessionCookie($cookie); } sub secData { - my ($this) = @_; - - if ($this->_sessionCookie) { - return join ('|',$this->_passwordImage, $this->_sessionCookie ); - } else { - return $this->_passwordImage; - } + my ($this) = @_; + + if ($this->_sessionCookie) { + return join ('|',$this->_passwordImage, $this->_sessionCookie ); + } else { + return $this->_passwordImage; + } } sub isTrusted { - my ($this) = @_; - - $this->_sessionCookie ? 1 : 0; + my ($this) = @_; + + $this->_sessionCookie ? 1 : 0; } sub DoAuth { - my ($this,$challenge) = @_; + my ($this,$challenge) = @_; - if (Digest::MD5::md5_hex($challenge) eq $this->_passwordImage) { - return (AUTH_SUCCESS,$this->_sessionCookie($this->GenSSID)); - } elsee { - return (AUTH_FAIL,$this->_sessionCookie(undef)); - } + if (Digest::MD5::md5_hex($challenge) eq $this->_passwordImage) { + return (AUTH_SUCCESS,$this->_sessionCookie($this->GenSSID)); + } elsee { + return (AUTH_FAIL,$this->_sessionCookie(undef)); + } } sub ValidateSession { - my ($this,$cookie) = @_; - - die new IMPL::InvalidOperationException("The context is untrusted") unless $this->_sessionCookie; - - if ($cookie eq $this->_sessionCookie) { - return (AUTH_SUCCESS,undef); - } else { - return (AUTH_FAIL,undef); - } + my ($this,$cookie) = @_; + + die new IMPL::InvalidOperationException("The context is untrusted") unless $this->_sessionCookie; + + if ($cookie eq $this->_sessionCookie) { + return (AUTH_SUCCESS,undef); + } else { + return (AUTH_FAIL,undef); + } } sub CreateSecData { - my ($self,%args) = @_; - - die new IMPL::InvalidArgumentException("The parameter is required",'password') unless $args{password}; - - return Digest::MD5::md5_hex($args{password}); + my ($self,%args) = @_; + + die new IMPL::InvalidArgumentException("The parameter is required",'password') unless $args{password}; + + return Digest::MD5::md5_hex($args{password}); } sub SecDataArgs { - password => 'SCALAR' + password => 'SCALAR' } 1;