Search in sources :

Example 1 with SystemAuthentication

use of org.bimserver.shared.SystemAuthentication 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);
    }
}
Also used : AuthInterface(org.bimserver.shared.interfaces.AuthInterface) UsernamePasswordAuthenticationInfo(org.bimserver.shared.UsernamePasswordAuthenticationInfo) UserTokenAuthentication(org.bimserver.shared.UserTokenAuthentication) PublicInterfaceNotFoundException(org.bimserver.shared.exceptions.PublicInterfaceNotFoundException) AutologinAuthenticationInfo(org.bimserver.shared.AutologinAuthenticationInfo) TokenAuthentication(org.bimserver.shared.TokenAuthentication) UserTokenAuthentication(org.bimserver.shared.UserTokenAuthentication) SystemAuthentication(org.bimserver.shared.SystemAuthentication)

Aggregations

AutologinAuthenticationInfo (org.bimserver.shared.AutologinAuthenticationInfo)1 SystemAuthentication (org.bimserver.shared.SystemAuthentication)1 TokenAuthentication (org.bimserver.shared.TokenAuthentication)1 UserTokenAuthentication (org.bimserver.shared.UserTokenAuthentication)1 UsernamePasswordAuthenticationInfo (org.bimserver.shared.UsernamePasswordAuthenticationInfo)1 PublicInterfaceNotFoundException (org.bimserver.shared.exceptions.PublicInterfaceNotFoundException)1 AuthInterface (org.bimserver.shared.interfaces.AuthInterface)1