Skip to content

Commit

Permalink
Add guava library
Browse files Browse the repository at this point in the history
  • Loading branch information
enricovianello committed Apr 4, 2024
1 parent 257ac81 commit 57047f3
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 9 deletions.
13 changes: 10 additions & 3 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@
<mockito.version>1.9.5</mockito.version>
<jcip.version>1.0</jcip.version>
<bc.version>1.58</bc.version>
<guava.version>33.1.0-jre</guava.version>

<!-- properties -->
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
Expand Down Expand Up @@ -249,19 +250,25 @@
<artifactId>canl</artifactId>
<version>${canl.version}</version>
</dependency>

<dependency>
<groupId>org.bouncycastle</groupId>
<artifactId>bcpkix-jdk15on</artifactId>
<version>${bc.version}</version>
</dependency>
<dependency>

<dependency>
<groupId>org.bouncycastle</groupId>
<artifactId>bcprov-jdk15on</artifactId>
<version>${bc.version}</version>
</dependency>

<dependency>
<groupId>com.google.guava</groupId>
<artifactId>guava</artifactId>
<version>${guava.version}</version>
</dependency>

<dependency>
<groupId>net.jcip</groupId>
<artifactId>jcip-annotations</artifactId>
Expand Down
15 changes: 9 additions & 6 deletions src/main/java/org/italiangrid/voms/util/CredentialsUtils.java
Original file line number Diff line number Diff line change
Expand Up @@ -27,14 +27,18 @@
import java.nio.file.Files;
import java.nio.file.NoSuchFileException;
import java.nio.file.Path;
import java.nio.file.Paths;
import java.nio.file.StandardOpenOption;
import java.nio.file.attribute.FileAttribute;
import java.nio.file.attribute.PosixFilePermission;
import java.nio.file.attribute.PosixFilePermissions;
import java.security.PrivateKey;
import java.security.cert.X509Certificate;
import java.util.Arrays;
import java.util.Set;

import com.google.common.collect.Sets;

import eu.emi.security.authn.x509.X509Credential;
import eu.emi.security.authn.x509.helpers.CertificateHelpers;
import eu.emi.security.authn.x509.impl.CertificateUtils;
Expand Down Expand Up @@ -218,13 +222,12 @@ public static void saveProxyCredentials(String proxyFileName, X509Credential uc,
ByteArrayOutputStream baos = new ByteArrayOutputStream();
saveProxyCredentials(baos, uc, encoding);
baos.close();
ByteBuffer proxyBuffer = ByteBuffer.wrap(baos.toByteArray());

Set<java.nio.file.attribute.PosixFilePermission> ownerWritable =
PosixFilePermissions.fromString("rw-------");
FileAttribute<?> permissions = PosixFilePermissions.asFileAttribute(ownerWritable);
Set<StandardOpenOption> options = Set.of(CREATE_NEW, WRITE);
Path proxyFilePath = Path.of(proxyFileName);
final ByteBuffer proxyBuffer = ByteBuffer.wrap(baos.toByteArray());
final Path proxyFilePath = Paths.get(proxyFileName);
final FileAttribute<Set<PosixFilePermission>> permissions =
PosixFilePermissions.asFileAttribute(PosixFilePermissions.fromString("rw-------"));
final Set<StandardOpenOption> options = Sets.newHashSet(CREATE_NEW, WRITE);

try {
Files.delete(proxyFilePath);
Expand Down

0 comments on commit 57047f3

Please sign in to comment.