Skip to content

This module gives you support for Authenticating a user in Token Based Authentication. As of now we do have support for Amazon Cognito Authentication.

Notifications You must be signed in to change notification settings

imYCGupta/auth-module

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

32 Commits
 
 
 
 
 
 
 
 

Repository files navigation

This module gives you support for Authenticating a user in Token Based Authentication. As of now we do have support for Amazon Cognito Authentication. It lets you

  • Sign Up User
  • Sign In User
  • Validate User using access token
  • Refresh Access Token
  • Change Password
It can be used as dependency as well in your maven project as below:
 <dependency>
	 <groupId>com.geekwise</groupId>
	 <artifactId>auth-module</artifactId>
	 <version>0.1</version>
 </dependency>

and define the repository as 
</repositories>
	<repository>
		<id>geekwise-auth-module</id>
	   	<url>https://github.com/imYCGupta/auth-module/raw/mvn-repo/</url>
	</repository>
</repositories>

After adding dependency, you can use following syntax to do

AuthService authService = new AmazonCognitoAuthServiceImpl(<Cognito-User-Pool-Id>, <Cognito-Client-Id>, <Cognito-Region>, <Credential-File-Path>);

Once you have authService object, you can call functions like below:

SignIn - signin(String email, String password) returns LoginResponseDTO which has AccessToken, Access Token Issued At, Access Token Expires At, Refresh Token \

Validate Access Token - isValidToken(String accessToken) returns boolean (true - if valid / false - if invalid) \

Get User Name Using Token - getUserNameByToken(String accessToken) returns String \

Descode Access Token - decodeToken(String accessToken) returns JSONObject \

Sign Up - signup(RegistrationDTO signupRequestDTO) returns UserType (userCretion details)

List Of User Group - getListOfUserGroups() returns List<String>

Create New Group - createNewUserGroup(String groupName, String groupDesc) returns boolean (true - if success / false - if fails)

Add User To Existing Group - addUserToGroup(String userName, String groupName) returns boolean (true - if success / false - if fails)

Remove User from Group - removeUserFromGroup(String userName, String groupName) returns boolean (true - if success / false - if fails)

Get User Groups For User - getUserGroupsForUser(String userName) returns List<String>

Receive OTP on Email - forgotPassword(String userName) returns boolean (true - if email sent / false - if fails)

Reset Password with OTP - resetPassword(ResetPasswordDTO newPasswordDTO) returns boolean (true - if success / false - if fails)

Refresh Access Token with Refresh Token - refreshAccessToken(String refreshToken) returns LoginResponseDTO which has new AccessToken, Access Token Issued At, Access Token Expires At, Refresh Token

Mark Email Verified - verifyEmail(String email) returns boolean (true - if success / false - if fails)

Change Password - changePassword(String username, String oldPassword, String newPassword) returns boolean (true - if success / false - if fails)

Update Temp Password - updateTempPassword(String username, String oldPassword, String newPassword) returns LoginResponseDTO which has AccessToken, Access Token Issued At, Access Token Expires At, Refresh Token

Sign Out - signout(String userName) returns boolean (true - if success / false - if fails)

Releases

No releases published

Packages

No packages published

Languages