Skip to content

Commit

Permalink
#117 Removed unnecessary dependency (#122)
Browse files Browse the repository at this point in the history
  • Loading branch information
ckunki authored Sep 13, 2022
1 parent b61e346 commit 21de3be
Show file tree
Hide file tree
Showing 6 changed files with 104 additions and 94 deletions.
149 changes: 73 additions & 76 deletions dependencies.md

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

10 changes: 10 additions & 0 deletions doc/changes/changes_10.0.0.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,21 @@ Starting with major version 8 Exasol database uses the capabilities reported by
* #119: Changed SQL generator to format decimals always with decimal point `.` independent of the locale.<br />
Before method `SqlGenerationVisitor.visit(SqlLiteralDouble)` for instance returned values with decimal point `,` when the locale was set to `en_DE`.

## Refactoring

* #117 Removed unnecessary dependency

## Dependency Updates

### Compile Dependency Updates

* Removed `com.exasol:java-util-logging-testing:2.0.1`
* Updated `com.exasol:virtual-schema-common-java:15.3.2` to `16.1.0`
* Removed `javax.xml.bind:jaxb-api:2.4.0-b180830.0359`

### Test Dependency Updates

* Added `com.exasol:java-util-logging-testing:2.0.1`

### Plugin Dependency Updates

Expand Down
12 changes: 4 additions & 8 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -29,19 +29,15 @@
<version>16.1.0</version>
</dependency>
<dependency>
<groupId>javax.xml.bind</groupId>
<artifactId>jaxb-api</artifactId>
<version>2.4.0-b180830.0359</version>
<groupId>com.exasol</groupId>
<artifactId>error-reporting-java</artifactId>
<version>0.4.1</version>
</dependency>
<dependency>
<groupId>com.exasol</groupId>
<artifactId>java-util-logging-testing</artifactId>
<version>2.0.1</version>
</dependency>
<dependency>
<groupId>com.exasol</groupId>
<artifactId>error-reporting-java</artifactId>
<version>0.4.1</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.hamcrest</groupId>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,9 @@
package com.exasol.auth.kerberos;

import static javax.xml.bind.DatatypeConverter.parseBase64Binary;

import java.io.IOException;
import java.nio.file.Files;
import java.nio.file.Path;
import java.util.Base64;
import java.util.logging.Logger;

import com.exasol.errorreporting.ExaError;
Expand Down Expand Up @@ -82,12 +81,14 @@ private Path createCommonDirectoryForKerberosConfigurationFiles() throws IOExcep

private Path createTemporaryKerberosConfigFile(final String base64EncodedKerberosConfig,
final Path temporaryDirectory) throws IOException {
return createTemporaryFile(temporaryDirectory, "krb_", ".conf", parseBase64Binary(base64EncodedKerberosConfig));
return createTemporaryFile(temporaryDirectory, "krb_", ".conf",
Base64.getDecoder().decode(base64EncodedKerberosConfig.getBytes()));
}

private Path createTemporaryKeyTabFile(final String base64EncodedKeyTab, final Path temporaryDirectory)
throws IOException {
return createTemporaryFile(temporaryDirectory, "kt_", ".keytab", parseBase64Binary(base64EncodedKeyTab));
return createTemporaryFile(temporaryDirectory, "kt_", ".keytab",
Base64.getDecoder().decode(base64EncodedKeyTab.getBytes()));
}

private Path createTemporaryFile(final Path temporaryDirectory, final String prefix, final String suffix,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,7 @@

import java.sql.Connection;
import java.sql.SQLException;
import java.util.HashMap;
import java.util.Map;

import javax.xml.bind.DatatypeConverter;
import java.util.*;

import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
Expand Down Expand Up @@ -86,8 +83,8 @@ void testGetConnectionWithInaccessibleNamedConnectionThrowsException() throws Ex
@Test
void testGetConnectionWithKerberosDetailsInNamedConnection() throws SQLException, ExaConnectionAccessException {
final String principal = "the_kerberos_principal";
final String base64EncodedKerberosConfig = DatatypeConverter.printBase64Binary("<a></a>".getBytes());
final String base64EncodedKeyTab = DatatypeConverter.printBase64Binary("<b></b>".getBytes());
final String base64EncodedKerberosConfig = Base64.getEncoder().encodeToString("<a></a>".getBytes());
final String base64EncodedKeyTab = Base64.getEncoder().encodeToString("<b></b>".getBytes());
final String credentialString = "ExaAuthType=Kerberos;" + base64EncodedKerberosConfig + ";"
+ base64EncodedKeyTab;
when(this.exaConnectionMock.getUser()).thenReturn(principal);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
import java.io.IOException;
import java.nio.file.Files;
import java.nio.file.Paths;
import java.util.Base64;

import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
Expand Down Expand Up @@ -53,6 +54,14 @@ void testWriteKerberosConfigurationFiles() {
() -> assertKeyTableFileContent(getJaasConfigPathFromProperty()));
}

@Test
void base64() {
final byte[] raw = "some string".getBytes();
final byte[] encoded = Base64.getEncoder().encode(raw);
final byte[] decoded = Base64.getDecoder().decode(encoded);
assertThat(decoded, equalTo(raw));
}

private String getJaasConfigPathFromProperty() {
return System.getProperty(LOGIN_CONFIG_PROPERTY);
}
Expand Down

0 comments on commit 21de3be

Please sign in to comment.