dynamic-auth
v2.0.3
Published
Customizable authentication middleware for Express applications
Downloads
7
Maintainers
Readme
��#� �d�y�n�a�m�i�c�-�a�u�t�h� � � � �T�h�i�s� �p�a�c�k�a�g�e� �p�r�o�v�i�d�e�s� �c�u�s�t�o�m�i�z�a�b�l�e� �a�u�t�h�e�n�t�i�c�a�t�i�o�n� �m�i�d�d�l�e�w�a�r�e� �f�o�r� �E�x�p�r�e�s�s�.�j�s� �a�p�p�l�i�c�a�t�i�o�n�s�.� �I�t� �a�l�l�o�w�s� �u�s�e�r�s� �t�o� �e�a�s�i�l�y� �i�m�p�l�e�m�e�n�t� �u�s�e�r� �s�i�g�n�u�p� �a�n�d� �l�o�g�i�n� �f�u�n�c�t�i�o�n�a�l�i�t�y� �w�i�t�h� �M�o�n�g�o�D�B� �a�n�d� �J�W�T� �a�u�t�h�e�n�t�i�c�a�t�i�o�n�.� �U�s�e�r�s� �c�a�n� �s�p�e�c�i�f�y� �t�h�e�i�r� �o�w�n� �M�o�n�g�o�o�s�e� �m�o�d�e�l� �f�o�r� �t�h�e� �u�s�e�r� �a�n�d� �d�e�f�i�n�e� �t�h�e� �f�i�e�l�d�s� �f�o�r� �u�s�e�r� �d�a�t�a� �d�y�n�a�m�i�c�a�l�l�y�.� � � � � � �#�#� �M�o�n�g�o�D�B� �C�o�n�n�e�c�t�i�o�n� � � � �N�o�w� �w�i�t�h� �t�h�e� �'�d�y�n�a�m�i�c�-�a�u�t�h�'� �v�e�r�s�i�o�n� �2�.�0�.�1� �y�o�u� �c�a�n� �c�o�n�n�n�e�c�t� �y�o�u�r� �m�o�n�g�o�d�b� �w�i�t�h� �e�a�s�e�.� � � � �I�m�p�o�r�t� �'�c�r�e�a�t�e�M�o�n�g�o�D�B�C�o�n�n�e�c�t�i�o�n�'� �f�r�o�m� �d�y�n�a�m�i�c�-�a�u�t�h� �t�o� �u�s�e� �t�h�e� �f�u�n�c�t�i�o�n� �p�r�o�v�i�d�e�d� �b�y� �t�h�e� �p�a�c�k�a�g�e�.� � � � � � � � � � �c�o�n�s�t� �{�c�r�e�a�t�e�M�o�n�g�o�D�B�C�o�n�n�e�c�t�i�o�n�}� �=� �r�e�q�u�i�r�e�(�'�d�y�n�a�m�i�c�-�a�u�t�h�'�)�;� � � � �N�o�w� �j�u�s�t� �c�a�l�l� �t�h�e� �f�u�n�c�t�i�o�n� �a�n�d� �p�a�s�s� �t�h�e� �m�o�n�g�o�d�b� �u�r�i� �a�n�d� �t�h�e� �p�o�r�t� � � � � � � � � � � � �c�r�e�a�t�e�M�o�n�g�o�D�B�C�o�n�n�e�c�t�i�o�n�(�p�r�o�c�e�s�s�.�e�n�v�.�M�O�N�G�O�D�B�_�U�R�I�,�P�O�R�T�,�a�p�p�)�;� � � � �T�h�i�s� �a�p�p� �i�s� �t�h�e� �e�x�p�r�e�s�s�(�)� �i�n�i�t�i�a�l�i�z�e�d� �=�=�=�>� �c�o�n�s�t� �a�p�p� �=� �e�x�p�r�e�s�s�(�)�;� � � � �Y�o�u�r� �m�o�n�g�o�d�b� �i�s� �c�o�n�n�e�c�t�e�d� �e�a�s�i�l�y� �w�i�t�h� �j�u�s�t� �t�w�o� �l�i�n�e�s� �o�f� �c�o�d�e�.� � � � �#�#�#� �I�n�s�t�a�l�l�a�t�i�o�n� � � � �1�)� �C�r�e�a�t�e� �a� �b�a�c�k�e�n�d� �f�o�l�d�e�r� � � � �2�)� �i�n�s�t�a�l�l� �e�x�p�r�e�s�s�,� �m�o�n�g�o�o�s�e�,� �n�o�d�e�m�o�n�,� �c�o�r�s�,� �j�s�o�n�w�e�b�t�o�k�e�n� �a�n�d� �b�y�c�r�y�p�t� �p�a�c�k�a�g�e�s�:� � � � � � � � � � � � �n�p�m� �i� �e�x�p�r�e�s�s� �m�o�n�g�o�o�s�e� �n�o�d�e�m�o�n� �c�o�r�s� �j�s�o�n�w�e�b�t�o�k�e�n� �b�c�r�y�p�t� � �3�)� �C�r�e�a�t�e� �a� �m�o�d�e�l� �i�n� �a� �f�o�l�d�e�r� �a�n�d� �c�a�l�l� �i�t� �i�n� �t�h�e� �i�n�d�e�x�.�j�s� � � � �4�)� �C�o�n�n�e�c�t� �t�h�e� �m�o�n�g�o�d�b� �u�s�i�n�g� �m�o�n�g�o�o�s�e� � � � �5�)� �I�n�s�t�a�l�l� �t�h�e� �p�a�c�k�a�g�e� �"�d�y�n�a�m�i�c�-�a�u�t�h�"� � � � � � � � � � �n�p�m� �i� �d�y�n�a�m�i�c�-�a�u�t�h� � �6�)� �A�f�t�e�r� �t�h�e� �i�n�s�t�a�l�l�i�n�g� �t�h�e� �p�a�c�k�a�g�e� �i�n�i�t�i�a�l�i�z�e� �i�t� �w�i�t�h� �"� �c�o�n�s�t� �c�r�e�a�t�e�A�u�t�h�M�i�d�d�l�e�w�a�r�e� �=� �r�e�q�u�i�r�e�(�'�d�y�n�a�m�i�c�-�a�u�t�h�'�)�;� �"� � � � �7�)� �I�n� �t�h�e� �u�s�e�r�D�a�t�a�F�i�e�l�d�s� �c�o�n�s�t�a�n�t� �g�i�v�e� �t�h�e� �d�e�t�a�i�l�s� �r�e�q�u�i�r�e�d� �f�o�r� �s�i�g�n�u�p� � � � �8�)� �C�a�l�l� �t�h�e� �b�a�c�k�e�n�d� �u�s�i�n�g� � � � � � � � � � �a�p�p�.�u�s�e�(�'�/�a�u�t�h�'�,� �c�r�e�a�t�e�A�u�t�h�M�i�d�d�l�e�w�a�r�e�(�{� �j�w�t�S�e�c�r�e�t�:� �p�r�o�c�e�s�s�.�e�n�v�.�J�W�T�_�S�E�C�R�E�T�,� �U�s�e�r�M�o�d�e�l�:� �U�s�e�r�,� �u�s�e�r�D�a�t�a�F�i�e�l�d�s� �}�)�)�;� � � � �9�)� �F�o�r� �S�i�g�n�i�n� �u�s�e� �-� �h�t�t�p�:�/�/�l�o�c�a�l�h�o�s�t�:�3�0�0�0�/�a�u�t�h�/�s�i�g�n�u�p� �-� �t�h�i�s� �p�a�t�h� �a�n�d� �P�O�S�T� �m�e�t�h�o�d� � � � � � � � � �L�o�g�i�n� �u�s�e� �-� �h�t�t�p�:�/�/�l�o�c�a�l�h�o�s�t�:�3�0�0�0�/�a�u�t�h�/�l�o�g�i�n� �-� �t�h�i�s� �p�a�t�h� �a�n�d� �P�O�S�T� �m�e�t�h�o�d� � � � �1�0�)� �F�i�n�a�l�l�y� �d�o�n�'�t� �f�o�r�g�e�t� �t�o� �a�d�d� �t�h�e� �e�n�v� �f�i�l�e� �'�.�e�n�v�'� �f�o�r� �P�O�R�T�,� �M�O�N�G�O�D�B�_�U�R�I�,� �J�W�T�_�S�E�C�R�E�T� � � � �1�1�)� �Y�o�u�r� �b�a�c�k�e�n�d� �d�y�n�a�m�i�c� �a�u�t�h�e�n�t�i�c�a�t�i�o�n� �i�s� �r�e�a�d�y�.� � � � �#�#�#� �G�i�t�h�u�b� �l�i�n�k� �f�o�r� �r�e�f�e�r�e�n�c�e� �r�e�p�o�s�i�t�o�r�y� � � � �h�t�t�p�s�:�/�/�g�i�t�h�u�b�.�c�o�m�/�D�e�e�p�a�k�r�a�j�a�0�3�/�d�y�n�a�m�i�c�-�a�u�t�h�-�u�s�e�r�-�r�e�p�o�.�g�i�t� � �