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
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,5 @@ authlete.properties
.project
.classpath
.DS_Store
.idea/
*.iml
91 changes: 91 additions & 0 deletions src/main/java/com/authlete/common/dto/Service.java
Original file line number Diff line number Diff line change
Expand Up @@ -1980,6 +1980,26 @@ public class Service implements Serializable
*/
private boolean httpAliasProhibited;

/**
* The flag indicating whether the feature of TSL publishing for
* this service is enabled or not.
*
* @since 4.33
* @since Authlete 3.0.22
*/
private boolean tslPublishingEnabled;


/**
* TSL configuration data.
*
* @since 4.33
* @since Authlete 3.0.22
*
* @see <https://datatracker.ietf.org/doc/draft-ietf-oauth-status-list/>
* Trust Status List</a>
*/
private TslConfigData tslConfigData;

/**
* Get the service number.
Expand Down Expand Up @@ -13021,4 +13041,75 @@ public Service setHttpAliasProhibited(boolean prohibited)

return this;
}

/*
* Sets whether TSL publishing is enabled for this service.
*
* @param tslPublishingEnabled
* {@code true} to enable TSL publishing. {@code false} to disable it.
*
* @return
* this {@link Service} instance for method chaining
*
* @since 4.33
* @since Authlete 3.0.22
*/
public Service setTslPublishingEnabled(boolean tslPublishingEnabled)
{
this.tslPublishingEnabled = tslPublishingEnabled;

return this;
}

/**
* Get the flag indicating whether the feature of TSL publishing
* for this service is enabled or not.
*
* @return
* {@code true} if the feature of TSL publishing is enabled.
*
* @since 4.33
* @since Authlete 3.0.22
*/
public boolean isTslPublishingEnabled()
{
return tslPublishingEnabled;
}

/**
* Sets the {@link TslConfigData} for this service.
*
* @param tslConfigData
* the configuration data to be applied
*
* @return
* this {@code Service} instance for method chaining
*
* @since 4.33
* @since Authlete 3.0.22
*
* @see <a href="https://datatracker.ietf.org/doc/draft-ietf-oauth-status-list/">
* Trust Status List</a>
*/
public Service setTslConfigData(TslConfigData tslConfigData)
{
this.tslConfigData = tslConfigData;

return this;
}

/**
* Retrieves the {@link TslConfigData} associated with this service.
*
* @return
* the current {@link TslConfigData}
*
* @since 4.33
* @since Authlete 3.0.22
*/
public TslConfigData getTslConfigData()
{
return tslConfigData;

}
}
213 changes: 213 additions & 0 deletions src/main/java/com/authlete/common/dto/TslConfigData.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,213 @@
package com.authlete.common.dto;

import com.authlete.common.types.TslFormat;

import java.io.Serializable;
import java.net.URI;

/**
* A class that represents TSL configurations data
* The set consists of the following.
*
* <ul>
* <li>{@code format}
* <li>{@code validity}
* <li>{@code publishFrequency}
* <li>{@code timeToLive}
* <li>{@code publishEndpoint}
* </ul>
*
* @since 4.33
* @since Authlete 3.0.22
*
* @see <a href="https://datatracker.ietf.org/doc/draft-ietf-oauth-status-list/"
* >Token Status List (TSL)</a>
*/
public class TslConfigData implements Serializable
{

private static final long serialVersionUID = 1L;

/**
* The format of the TSL. Possible values are jwt and cwt. Currently only jwt is supported
*/
private TslFormat format;

/**
* The validity of the TSL in hours.
*/
private long validity;

/**
* Publish TSL after every X hours.
*/
private long publishFrequency;

/**
* Time to live in hours which provides indication to verifiers to cache this TSL
*/
private long timeToLive;

/**
* Endpoint where to publish this TSL
*/
private URI publishEndpoint;

/**
* The default constructor.
*/
public TslConfigData()
{
}

/**
* Copy constructor.
*/
public TslConfigData(TslConfigData tslConfigData)
{
if (tslConfigData == null)
{
return;
}
format = tslConfigData.getFormat();
validity = tslConfigData.getValidity();
publishFrequency = tslConfigData.getPublishFrequency();
timeToLive = tslConfigData.getTimeToLive();
publishEndpoint = tslConfigData.getPublishEndpoint();
}

/**
* Sets the publishing format for the TSL configuration.
*
* @param format
* the {@link TslFormat} value to set
*
* @return
* this {@code TslConfigData} instance for method chaining
*/
public TslConfigData setFormat(TslFormat format)
{
this.format = format;

return this;
}

/**
* Returns the publishing format of the TSL configuration.
*
* @return
* the {@link TslFormat} value currently configured
*/
public TslFormat getFormat()
{
return format;
}

/**
* Sets the TSL validity in hours.
*
* @param validity
* validity in hours
*
* @return
* this {@code TslConfigData} instance for method chaining
*/
public TslConfigData setValidity(long validity)
{
this.validity = validity;

return this;
}

/**
* Returns the TSL validity in hours.
*
* @return
* TSL validity
*/
public long getValidity()
{
return validity;
}

/**
* Sets the TSL publishing frequency in every X hours.
*
* @param publishFrequency
* TSL publish frequency
*
* @return
* this {@code TslConfigData} instance for method chaining
*/
public TslConfigData setPublishFrequency(long publishFrequency)
{
this.publishFrequency = publishFrequency;

return this;
}

/**
* Returns the TSL publishing frequency.
*
* @return
* TSL publishing frequency
*/
public long getPublishFrequency()
{
return publishFrequency;
}

/**
* Sets the ttl value of TSL in hours.
*
* @param timeToLive
* the ttl value
*
* @return
* this {@code TslConfigData} instance for method chaining
*/
public TslConfigData setTimeToLive(long timeToLive)
{
this.timeToLive = timeToLive;

return this;
}

/**
* Returns the ttl value.
*
* @return
* ttl value
*/
public long getTimeToLive()
{
return timeToLive;
}

/**
* Sets the TSL publishing endpoint.
*
* @param publishEndpoint
* TSL publish endpoint
*
* @return
* this {@code TslConfigData} instance for method chaining
*/
public TslConfigData setPublishEndpoint(URI publishEndpoint)
{
this.publishEndpoint = publishEndpoint;

return this;
}

/**
* Returns the TSL publishing endpoint.
*
* @return
* TSL publishing endpoint
*/
public URI getPublishEndpoint()
{
return publishEndpoint;
}
}
Loading