use of org.bimserver.shared.UserTokenAuthentication in project BIMserver by opensourceBIM.
the class BimServerClient method authenticate.
public void authenticate() throws ServerException, UserException {
try {
AuthInterface authInterface = channel.get(AuthInterface.class);
if (authenticationInfo instanceof UsernamePasswordAuthenticationInfo) {
UsernamePasswordAuthenticationInfo usernamePasswordAuthenticationInfo = (UsernamePasswordAuthenticationInfo) authenticationInfo;
setToken(authInterface.login(usernamePasswordAuthenticationInfo.getUsername(), usernamePasswordAuthenticationInfo.getPassword()));
} else if (authenticationInfo instanceof AutologinAuthenticationInfo) {
AutologinAuthenticationInfo autologinAuthenticationInfo = (AutologinAuthenticationInfo) authenticationInfo;
setToken(autologinAuthenticationInfo.getAutologinCode());
} else if (authenticationInfo instanceof TokenAuthentication) {
TokenAuthentication tokenAuthentication = (TokenAuthentication) authenticationInfo;
setToken(tokenAuthentication.getToken());
} else if (authenticationInfo instanceof UserTokenAuthentication) {
UserTokenAuthentication tokenAuthentication = (UserTokenAuthentication) authenticationInfo;
setToken(authInterface.loginUserToken(tokenAuthentication.getToken()));
} else if (authenticationInfo instanceof SystemAuthentication) {
}
} catch (PublicInterfaceNotFoundException e) {
LOGGER.error("", e);
}
}
Aggregations