Search in sources :

Example 1 with ParameterTagMapping

use of org.firebirdsql.gds.ParameterTagMapping 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 ParameterTagMapping

use of org.firebirdsql.gds.ParameterTagMapping 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());
    }
    Map<String, String> configMap = new HashMap<>();
    if (props.getWireCryptAsEnum() != WireCrypt.DEFAULT) {
        configMap.put("WireCrypt", props.getWireCrypt());
    }
    String authPlugins = props.getAuthPlugins();
    if (authPlugins != null && !authPlugins.isEmpty()) {
        configMap.put("AuthClient", authPlugins);
    }
    if (!configMap.isEmpty()) {
        String configString = buildConfigString(configMap);
        pb.addArgument(tagMapping.getConfigTag(), configString);
    }
}
Also used : ParameterTagMapping(org.firebirdsql.gds.ParameterTagMapping) HashMap(java.util.HashMap)

Example 3 with ParameterTagMapping

use of org.firebirdsql.gds.ParameterTagMapping 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(), LEGACY_PASSWORD_SALT).substring(2, 13));
    }
}
Also used : ParameterTagMapping(org.firebirdsql.gds.ParameterTagMapping)

Example 4 with ParameterTagMapping

use of org.firebirdsql.gds.ParameterTagMapping 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 5 with ParameterTagMapping

use of org.firebirdsql.gds.ParameterTagMapping in project jaybird by FirebirdSQL.

the class ClientAuthBlock method cleanParameterBuffer.

private void cleanParameterBuffer(ConnectionParameterBuffer pb) {
    ParameterTagMapping tagMapping = pb.getTagMapping();
    pb.removeArgument(tagMapping.getPasswordTag());
    pb.removeArgument(tagMapping.getEncryptedPasswordTag());
    pb.removeArgument(tagMapping.getTrustedAuthTag());
}
Also used : ParameterTagMapping(org.firebirdsql.gds.ParameterTagMapping)

Aggregations

ParameterTagMapping (org.firebirdsql.gds.ParameterTagMapping)6 IAttachProperties (org.firebirdsql.gds.ng.IAttachProperties)2 HashMap (java.util.HashMap)1