Search in sources :

Example 1 with UsernameCallback

use of com.mysql.cj.callback.UsernameCallback in project ABC by RuiPinto96274.

the class AuthenticationKerberosClient method setAuthenticationParameters.

@Override
public void setAuthenticationParameters(String user, String password) {
    this.user = user;
    this.password = password;
    if (this.user == null) {
        try {
            // Try to obtain the user name from a cached TGT.
            initializeAuthentication();
            int pos = this.cachedPrincipalName.indexOf('@');
            if (pos >= 0) {
                this.user = this.cachedPrincipalName.substring(0, pos);
            } else {
                this.user = this.cachedPrincipalName;
            }
        } catch (CJException e) {
            // Fall-back to system login user.
            this.user = System.getProperty("user.name");
        }
        if (this.usernameCallbackHandler != null) {
            this.usernameCallbackHandler.handle(new UsernameCallback(this.user));
        }
    }
}
Also used : UsernameCallback(com.mysql.cj.callback.UsernameCallback) CJException(com.mysql.cj.exceptions.CJException)

Example 2 with UsernameCallback

use of com.mysql.cj.callback.UsernameCallback in project JavaSegundasQuintas by ecteruel.

the class AuthenticationKerberosClient method setAuthenticationParameters.

@Override
public void setAuthenticationParameters(String user, String password) {
    this.user = user;
    this.password = password;
    if (this.user == null) {
        try {
            // Try to obtain the user name from a cached TGT.
            initializeAuthentication();
            int pos = this.cachedPrincipalName.indexOf('@');
            if (pos >= 0) {
                this.user = this.cachedPrincipalName.substring(0, pos);
            } else {
                this.user = this.cachedPrincipalName;
            }
        } catch (CJException e) {
            // Fall-back to system login user.
            this.user = System.getProperty("user.name");
        }
        if (this.usernameCallbackHandler != null) {
            this.usernameCallbackHandler.handle(new UsernameCallback(this.user));
        }
    }
}
Also used : UsernameCallback(com.mysql.cj.callback.UsernameCallback) CJException(com.mysql.cj.exceptions.CJException)

Example 3 with UsernameCallback

use of com.mysql.cj.callback.UsernameCallback in project JavaSegundasQuintas by ecteruel.

the class AuthenticationLdapSaslClientPlugin method setAuthenticationParameters.

@Override
public void setAuthenticationParameters(String user, String password) {
    this.user = user;
    this.password = password;
    if (this.user == null) {
        // Fall-back to system login user.
        this.user = System.getProperty("user.name");
        if (this.usernameCallbackHandler != null) {
            this.usernameCallbackHandler.handle(new UsernameCallback(this.user));
        }
    }
}
Also used : UsernameCallback(com.mysql.cj.callback.UsernameCallback)

Example 4 with UsernameCallback

use of com.mysql.cj.callback.UsernameCallback in project aws-mysql-jdbc by awslabs.

the class AuthenticationKerberosClient method setAuthenticationParameters.

@Override
public void setAuthenticationParameters(String user, String password) {
    this.user = user;
    this.password = password;
    if (this.user == null) {
        try {
            // Try to obtain the user name from a cached TGT.
            initializeAuthentication();
            int pos = this.cachedPrincipalName.indexOf('@');
            if (pos >= 0) {
                this.user = this.cachedPrincipalName.substring(0, pos);
            } else {
                this.user = this.cachedPrincipalName;
            }
        } catch (CJException e) {
            // Fall-back to system login user.
            this.user = System.getProperty("user.name");
        }
        if (this.usernameCallbackHandler != null) {
            this.usernameCallbackHandler.handle(new UsernameCallback(this.user));
        }
    }
}
Also used : UsernameCallback(com.mysql.cj.callback.UsernameCallback) CJException(com.mysql.cj.exceptions.CJException)

Example 5 with UsernameCallback

use of com.mysql.cj.callback.UsernameCallback in project aws-mysql-jdbc by awslabs.

the class AuthenticationLdapSaslClientPlugin method setAuthenticationParameters.

@Override
public void setAuthenticationParameters(String user, String password) {
    this.user = user;
    this.password = password;
    if (this.user == null) {
        // Fall-back to system login user.
        this.user = System.getProperty("user.name");
        if (this.usernameCallbackHandler != null) {
            this.usernameCallbackHandler.handle(new UsernameCallback(this.user));
        }
    }
}
Also used : UsernameCallback(com.mysql.cj.callback.UsernameCallback)

Aggregations

UsernameCallback (com.mysql.cj.callback.UsernameCallback)6 CJException (com.mysql.cj.exceptions.CJException)3