
 
 p a c k a g e   a u t h   / /   i m p o r t   " i m u s l a b . c o m / a r o z o s / m o d / a u t h " 
 
 
 
 
 
 F U N C T I O N S 
 
 
 
 f u n c   H a s h ( r a w   s t r i n g )   s t r i n g 
 
 f u n c   m v ( r   * h t t p . R e q u e s t ,   g e t P a r a m t e r   s t r i n g ,   p o s t M o d e   b o o l )   ( s t r i n g ,   e r r o r ) 
 
 f u n c   s e n d E r r o r R e s p o n s e ( w   h t t p . R e s p o n s e W r i t e r ,   e r r M s g   s t r i n g ) 
 
 f u n c   s e n d J S O N R e s p o n s e ( w   h t t p . R e s p o n s e W r i t e r ,   j s o n   s t r i n g ) 
 
         S e n d   J S O N   r e s p o n s e ,   w i t h   a n   e x t r a   j s o n   h e a d e r 
 
 
 
 f u n c   s e n d O K ( w   h t t p . R e s p o n s e W r i t e r ) 
 
 f u n c   s e n d T e x t R e s p o n s e ( w   h t t p . R e s p o n s e W r i t e r ,   m s g   s t r i n g ) 
 
         C o m m o n   f u n c t i o n s 
 
 
 
 
 
 T Y P E S 
 
 
 
 t y p e   A u t h A g e n t   s t r u c t   { 
 
 	 S e s s i o n N a m e                           s t r i n g 
 
 	 A l l o w R e g i s t e r                       b o o l 
 
 	 S e s s i o n S t o r e                         * s e s s i o n s . C o o k i e S t o r e 
 
 	 D a t a b a s e                                 * d b . D a t a b a s e 
 
 	 L o g i n R e d i r e c t i o n H a n d l e r   f u n c ( h t t p . R e s p o n s e W r i t e r ,   * h t t p . R e q u e s t ) 
 
 } 
 
 
 
 f u n c   N e w A u t h e n t i c a t i o n A g e n t ( s e s s i o n N a m e   s t r i n g ,   k e y   [ ] b y t e ,   s y s d b   * d b . D a t a b a s e ,   a l l o w R e g   b o o l ,   l o g i n R e d i r e c t i o n H a n d l e r   f u n c ( h t t p . R e s p o n s e W r i t e r ,   * h t t p . R e q u e s t ) )   * A u t h A g e n t 
 
         C o n s t r u c t o r 
 
 
 
 f u n c   ( a   * A u t h A g e n t )   C h e c k A l l o w R e g i s t e r ( w   h t t p . R e s p o n s e W r i t e r ,   r   * h t t p . R e q u e s t ) 
 
 
 
 f u n c   ( a   * A u t h A g e n t )   C h e c k A u t h ( r   * h t t p . R e q u e s t )   b o o l 
 
 
 
 f u n c   ( a   * A u t h A g e n t )   C h e c k L o g i n ( w   h t t p . R e s p o n s e W r i t e r ,   r   * h t t p . R e q u e s t ) 
 
 
 
 f u n c   ( a   * A u t h A g e n t )   C r e a t e U s e r A c c o u n t ( n e w u s e r n a m e   s t r i n g ,   p a s s w o r d   s t r i n g ,   g r o u p   [ ] s t r i n g )   e r r o r 
 
 
 
 f u n c   ( a   * A u t h A g e n t )   G e t U s e r C o u n t s ( )   i n t 
 
 
 
 f u n c   ( a   * A u t h A g e n t )   G e t U s e r N a m e ( w   h t t p . R e s p o n s e W r i t e r ,   r   * h t t p . R e q u e s t )   ( s t r i n g ,   e r r o r ) 
 
 
 
 f u n c   ( a   * A u t h A g e n t )   H a n d l e C h e c k A u t h ( w   h t t p . R e s p o n s e W r i t e r ,   r   * h t t p . R e q u e s t ,   h a n d l e r   f u n c ( h t t p . R e s p o n s e W r i t e r ,   * h t t p . R e q u e s t ) ) 
 
         T h i s   f u n c t i o n   w i l l   h a n d l e   a n   h t t p   r e q u e s t   a n d   r e d i r e c t   t o   t h e   g i v e n   l o g i n 
 
         a d d r e s s   i f   n o t   l o g g e d   i n 
 
 
 
 f u n c   ( a   * A u t h A g e n t )   H a n d l e L o g i n ( w   h t t p . R e s p o n s e W r i t e r ,   r   * h t t p . R e q u e s t ) 
 
         E x p o r t e d   F u n c t i o n s 
 
 
 
 f u n c   ( a   * A u t h A g e n t )   H a n d l e L o g o u t ( w   h t t p . R e s p o n s e W r i t e r ,   r   * h t t p . R e q u e s t ) 
 
 
 
 f u n c   ( a   * A u t h A g e n t )   H a n d l e R e g i s t e r ( w   h t t p . R e s p o n s e W r i t e r ,   r   * h t t p . R e q u e s t ) 
 
 
 
 f u n c   ( a   * A u t h A g e n t )   H a n d l e U n r e g i s t e r ( w   h t t p . R e s p o n s e W r i t e r ,   r   * h t t p . R e q u e s t ) 
 
 
 
 f u n c   ( a   * A u t h A g e n t )   L i s t U s e r s ( )   [ ] s t r i n g 
 
 
 
 f u n c   ( a   * A u t h A g e n t )   R e g i s t e r A P I s ( e p   A u t h E n d p o i n t s ) 
 
 
 
 f u n c   ( a   * A u t h A g e n t )   U p d a t e S e s s i o n E x p i r e T i m e ( w   h t t p . R e s p o n s e W r i t e r ,   r   * h t t p . R e q u e s t )   b o o l 
 
 
 
 f u n c   ( a   * A u t h A g e n t )   U s e r E x i s t s ( u s e r n a m e   s t r i n g )   b o o l 
 
 
 
 t y p e   A u t h E n d p o i n t s   s t r u c t   { 
 
 	 L o g i n                             s t r i n g 
 
 	 L o g o u t                           s t r i n g 
 
 	 R e g i s t e r                       s t r i n g 
 
 	 U n r e g i s t e r                   s t r i n g 
 
 	 C h e c k L o g g e d I n             s t r i n g 
 
 	 C h e c k A l l o w R e g i s t e r   s t r i n g 
 
 } 
 
 
 
 