-
Notifications
You must be signed in to change notification settings - Fork 0
1.0.1 AuthenticationService
Anders Mikkelsen edited this page Dec 21, 2017
·
4 revisions
Implementations of the AuthenticationService answer to the following contract:
@ProxyGen
@VertxGen
public interface AuthenticationService {
@Fluent
AuthenticationService createJwtFromProvider(@Nonnull String token, @Nonnull String authProvider,
@Nonnull Handler<AsyncResult<AuthPackage>> resultHandler);
@Fluent
AuthenticationService refresh(@Nonnull String refreshToken,
@Nonnull Handler<AsyncResult<TokenContainer>> resultHandler);
@Fluent
@GenIgnore
default AuthenticationService switchToAssociatedDomain(String domainId, Jws<Claims> verifyResult,
Handler<AsyncResult<TokenContainer>> resultHandler) {
resultHandler.handle(Future.failedFuture(new NotImplementedException()));
return this;
}
@ProxyClose
void close();
}
An implementation is expect to produce JWT's based on the token received for an external provider as defined by the Provider interface. It should also be able to refresh an outdated token as a result of an incoming refreshToken. Lastly it should have an implementation for switching from one domain to another, generating a new JWT.
The default implementation AuthenticationServiceImpl is whats used by the JWTGenerator class and can also be deployed as a service on the cluster. It is also reliant on Redis and expects the following parameter in its config:
{
"redis_host" : "<string>",
"redis_port" : "<integer>" // optional
}