The quickest way to support authentication on your app.
<dependency>
<groupId>io.github.encryptorcode</groupId>
<artifactId>iam-oauth</artifactId>
<version>2.0.1</version>
</dependency>
implementation 'io.github.encryptorcode:iam-oauth:2.0.1'
implementation("io.github.encryptorcode:iam-oauth:2.0.1")
This is a library for all your authentication needs. From the scratch it's made to give you full flexibility for advanced implementation, also making sure it's easy to implement for starters.
You need to write bare minimal to set up your authentication.
AuthenticationInitializer.newInstance(Session::new, User::new)
.addOAuthProvider(new GoogleAuthenticationProvider())
.initialize();
GoogleAuthenticationProvider
An implementation for supporting Oauth 2.0 authentication using Google.- We also have ready-made implementations for supporting storage with files, db and redis.
For complete example, check example folder given in the repository.
To completely customising and setting up authentication you can follow the guides below.
- Configure your oauth provider(s)
- Create your User and Session implementations
- Customise your way to store of Users, Session and AuthenticationDetails
- Setup your security for your users
- Handle server requests
Getting instance of authentication service
AuthenticationService<Session, User> authenticationService = AuthenticationService.getInstance();
Getting the current user
User currentUser = authenticationService.getCurrentUser();
Getting the current session
Session currentSession = authenticationService.getCurrentUser();
Note: Both user and session will be set only in a HttpRequest. It will get a null if you invoke this on a TimerTask or Scheduler.
MIT