Search in sources :

Example 1 with IAttachProperties

use of org.firebirdsql.gds.ng.IAttachProperties in project jaybird by FirebirdSQL.

the class V10ParameterConverter method populateAuthenticationProperties.

@Override
protected void populateAuthenticationProperties(final AbstractConnection connection, final ConnectionParameterBuffer pb) throws SQLException {
    IAttachProperties props = connection.getAttachProperties();
    ParameterTagMapping tagMapping = pb.getTagMapping();
    if (props.getUser() != null) {
        pb.addArgument(tagMapping.getUserNameTag(), props.getUser());
    }
    if (props.getPassword() != null) {
        pb.addArgument(tagMapping.getEncryptedPasswordTag(), UnixCrypt.crypt(props.getPassword(), LegacyAuthenticationPlugin.LEGACY_PASSWORD_SALT).substring(2, 13));
    }
}
Also used : ParameterTagMapping(org.firebirdsql.gds.ParameterTagMapping) IAttachProperties(org.firebirdsql.gds.ng.IAttachProperties)

Example 2 with IAttachProperties

use of org.firebirdsql.gds.ng.IAttachProperties in project jaybird by FirebirdSQL.

the class JnaParameterConverter method populateAuthenticationProperties.

@Override
protected void populateAuthenticationProperties(final AbstractConnection connection, final ConnectionParameterBuffer pb) throws SQLException {
    IAttachProperties props = connection.getAttachProperties();
    ParameterTagMapping tagMapping = pb.getTagMapping();
    if (props.getUser() != null) {
        pb.addArgument(tagMapping.getUserNameTag(), props.getUser());
    }
    if (props.getPassword() != null) {
        pb.addArgument(tagMapping.getPasswordTag(), props.getPassword());
    }
    if (props.getWireCrypt() != WireCrypt.DEFAULT) {
        // Need to do this differently when having to add multiple configs
        String configString = "WireCrypt = " + props.getWireCrypt();
        pb.addArgument(tagMapping.getConfigTag(), configString);
    }
}
Also used : ParameterTagMapping(org.firebirdsql.gds.ParameterTagMapping) IAttachProperties(org.firebirdsql.gds.ng.IAttachProperties)

Example 3 with IAttachProperties

use of org.firebirdsql.gds.ng.IAttachProperties in project jaybird by FirebirdSQL.

the class V13ParameterConverter method populateAuthenticationProperties.

@Override
protected void populateAuthenticationProperties(final AbstractConnection connection, final ConnectionParameterBuffer pb) throws SQLException {
    if (!(connection instanceof WireConnection)) {
        throw new IllegalArgumentException("populateAuthenticationProperties should have been called with a WireConnection instance, was " + connection.getClass().getName());
    }
    IAttachProperties props = connection.getAttachProperties();
    ParameterTagMapping tagMapping = pb.getTagMapping();
    if (props.getUser() != null) {
        pb.addArgument(tagMapping.getUserNameTag(), props.getUser());
    }
    ClientAuthBlock clientAuthBlock = ((WireConnection) connection).getClientAuthBlock();
    if (clientAuthBlock.isAuthComplete()) {
        return;
    }
    clientAuthBlock.authFillParametersBlock(pb);
}
Also used : IAttachProperties(org.firebirdsql.gds.ng.IAttachProperties) WireConnection(org.firebirdsql.gds.ng.wire.WireConnection) ClientAuthBlock(org.firebirdsql.gds.ng.wire.auth.ClientAuthBlock)

Aggregations

IAttachProperties (org.firebirdsql.gds.ng.IAttachProperties)3 ParameterTagMapping (org.firebirdsql.gds.ParameterTagMapping)2 WireConnection (org.firebirdsql.gds.ng.wire.WireConnection)1 ClientAuthBlock (org.firebirdsql.gds.ng.wire.auth.ClientAuthBlock)1