Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions .git-blame-ignore-revs
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
# SPDX-FileCopyrightText: 2006 Istituto Nazionale di Fisica Nucleare
#
# SPDX-License-Identifier: Apache-2.0

# Format code
97145e5e6cf3138e451975815a1bdb596f671e43
27 changes: 27 additions & 0 deletions .github/workflows/check-formatting.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
# SPDX-FileCopyrightText: 2006 Istituto Nazionale di Fisica Nucleare
#
# SPDX-License-Identifier: Apache-2.0

name: Check formatting

on: [push, pull_request]

jobs:
check-formatting:
if: github.event_name != 'pull_request' || github.event.pull_request.head.repo.full_name != github.event.pull_request.base.repo.full_name
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v6
- name: Set up JDK 21
uses: actions/setup-java@v5
with:
distribution: 'temurin'
java-version: 21
- name: Cache Maven packages
uses: actions/cache@v5
with:
path: ~/.m2
key: ${{ runner.os }}-m2-${{ hashFiles('**/pom.xml') }}
restore-keys: ${{ runner.os }}-m2
- name: Check formatting
run: mvn -B spotless:check
12 changes: 12 additions & 0 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ SPDX-License-Identifier: Apache-2.0
<plugin.central-publishing.version>0.10.0</plugin.central-publishing.version>
<plugin.maven-gpg.version>3.2.8</plugin.maven-gpg.version>
<plugin.javadoc.version>3.12.0</plugin.javadoc.version>
<plugin.spotless.version>3.4.0</plugin.spotless.version>

<junit.version>4.13.2</junit.version>
<hamcrest.version>3.0</hamcrest.version>
Expand Down Expand Up @@ -231,6 +232,17 @@ SPDX-License-Identifier: Apache-2.0
</execution>
</executions>
</plugin>

<plugin>
<groupId>com.diffplug.spotless</groupId>
<artifactId>spotless-maven-plugin</artifactId>
<version>${plugin.spotless.version}</version>
<configuration>
<java>
<googleJavaFormat />
</java>
</configuration>
</plugin>
</plugins>
</build>

Expand Down
100 changes: 44 additions & 56 deletions src/main/java/org/italiangrid/voms/VOMSAttribute.java
Original file line number Diff line number Diff line change
Expand Up @@ -8,154 +8,142 @@
import java.security.cert.X509Certificate;
import java.util.Date;
import java.util.List;

import javax.security.auth.x500.X500Principal;

import org.bouncycastle.cert.X509AttributeCertificateHolder;

/**
* The VOMS attributes information. This interface provides access to all the
* information available in a VOMS attribute certificate.
*
* @author Andrea Ceccanti
* The VOMS attributes information. This interface provides access to all the information available
* in a VOMS attribute certificate.
*
* @author Andrea Ceccanti
*/
public interface VOMSAttribute {

/**
* This method returns the name of the VO this VOMS attributes are about
*
*
* @return The name of the VO this VOMS attributes are about
*/
public String getVO();

/**
* This method returns the host where the VOMS Attribute Authority (AA) that
* signed these attribute lives
*
* @return The name of the host where the VOMS AA that signed these attributes
* lives
* This method returns the host where the VOMS Attribute Authority (AA) that signed these
* attribute lives
*
* @return The name of the host where the VOMS AA that signed these attributes lives
*/
public String getHost();

/**
* This method returns the port on which the VOMS Attribute Authority (AA)
* that signed these attributes listens for requests.
*
* @return The port on which the VOMS AA that signed these attributes listens
* for requests
* This method returns the port on which the VOMS Attribute Authority (AA) that signed these
* attributes listens for requests.
*
* @return The port on which the VOMS AA that signed these attributes listens for requests
*/
public int getPort();

/**
* This method returns the subject (as an {@link X500Principal}) of the holder
* of these VOMS attributes
*
* This method returns the subject (as an {@link X500Principal}) of the holder of these VOMS
* attributes
*
* @return The subject of the holder of these VOMS attributes
*/
public X500Principal getHolder();

/**
* This method returns the holder certificate serial number
*
*
* @return The serial number of the holder certificate
*/
public BigInteger getHolderSerialNumber();

/**
* This method returns the subject of the VOMS Attribute Authority that signed
* these attributes.
*
* This method returns the subject of the VOMS Attribute Authority that signed these attributes.
*
* @return The subject of the VOMS AA that signed these attributes
*/
public X500Principal getIssuer();

/**
* This method returns the attributes' validity start time
*
*
* @return The attributes' validity start time
*/
public Date getNotBefore();

/**
* This method returns the attributes' validity end time
*
*
* @return The attributes' validity end time
*/
public Date getNotAfter();

/**
* This method returns the list of signed Fully Qualified Attribute Names
* (FQANs) in this {@link VOMSAttribute}.
*
* This method returns the list of signed Fully Qualified Attribute Names (FQANs) in this {@link
* VOMSAttribute}.
*
* @return The {@link List} of VOMS fully qualified attribute names
*/
public List<String> getFQANs();

/**
* This method returns the primary FQAN (the first in the list returned by
* {@link #getFQANs()}) in this {@link VOMSAttribute}.
*
* This method returns the primary FQAN (the first in the list returned by {@link #getFQANs()}) in
* this {@link VOMSAttribute}.
*
* @return The primary VOMS fully qualified attribute name
*/
public String getPrimaryFQAN();

/**
* This method returns the signature on the VOMS attribute certificate as a
* byte array.
*
* This method returns the signature on the VOMS attribute certificate as a byte array.
*
* @return The signature of this VOMS attributes
*/
public byte[] getSignature();

/**
* This method returns the list of VOMS Generic attributes in this
* {@link VOMSAttribute}.
*
* This method returns the list of VOMS Generic attributes in this {@link VOMSAttribute}.
*
* @return The VOMS generic attributes
*/
public List<VOMSGenericAttribute> getGenericAttributes();

/**
* This method returns the list of targets defined for this
* {@link VOMSAttribute}.
*
* This method returns the list of targets defined for this {@link VOMSAttribute}.
*
* @return The targets for this VOMS attributes
*/
public List<String> getTargets();

/**
* This method returns the certificate chain of the VOMS Attribute Authority
* (AA) that signed this {@link VOMSAttribute}.
*
* This method returns the certificate chain of the VOMS Attribute Authority (AA) that signed this
* {@link VOMSAttribute}.
*
* @return The VOMS AA certificate chain
*/
public X509Certificate[] getAACertificates();

/**
* This method checks whether the attributes are valid in the current instant
* of time. No validation is performed on the attributes.
*
* This method checks whether the attributes are valid in the current instant of time. No
* validation is performed on the attributes.
*
* @return <code>true</code> if valid, <code>false</code> otherwise
*/
public boolean isValid();

/**
* This method checks whether the attributes are valid in a given time passed
* as argument. No validation is performed on the attributes.
*
* @param time
* the time used for the validity check
* This method checks whether the attributes are valid in a given time passed as argument. No
* validation is performed on the attributes.
*
* @param time the time used for the validity check
* @return <code>true</code> if valid, <code>false</code> otherwise
*/
public boolean validAt(Date time);

/**
* This method returns the underlying VOMS Attribute certificate object.
*
* @return the underlying bouncycastle object for the VOMS attribute
* certificate.
*
* @return the underlying bouncycastle object for the VOMS attribute certificate.
*/
public X509AttributeCertificateHolder getVOMSAC();

}
7 changes: 2 additions & 5 deletions src/main/java/org/italiangrid/voms/VOMSError.java
Original file line number Diff line number Diff line change
Expand Up @@ -6,15 +6,12 @@

/**
* The base VOMS exception class.
*
* @author Andrea Ceccanti
*
* @author Andrea Ceccanti
*/
public class VOMSError extends RuntimeException {

/**
*
*/
/** */
private static final long serialVersionUID = 1L;

public VOMSError(String message) {
Expand Down
14 changes: 5 additions & 9 deletions src/main/java/org/italiangrid/voms/VOMSGenericAttribute.java
Original file line number Diff line number Diff line change
Expand Up @@ -5,34 +5,30 @@
package org.italiangrid.voms;

/**
* A VOMS generic attribute is a name=value pair attribute augmented with a
* context.
*
*
* @author Andrea Ceccanti
* A VOMS generic attribute is a name=value pair attribute augmented with a context.
*
* @author Andrea Ceccanti
*/
public interface VOMSGenericAttribute {

/**
* This method returns the name of this generic attribute
*
*
* @return the name of this generic attribute
*/
public String getName();

/**
* This method returns the value of this generic attribute
*
*
* @return the value of this generic attribute
*/
public String getValue();

/**
* This method returns the context for this generic attribute
*
*
* @return the context of this generic attribute
*/
public String getContext();

}
Loading