Skip to content

Commit

Permalink
Merge pull request #72 from bci-oss/feature/add-ttl-field
Browse files Browse the repository at this point in the history
new field timeToLive for registration process
  • Loading branch information
tunacicek authored Jan 9, 2024
2 parents 1b6cf6f + 762e111 commit 5219305
Show file tree
Hide file tree
Showing 12 changed files with 70 additions and 45 deletions.
7 changes: 7 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,12 @@ All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), and this project adheres
to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

## 0.2.8
### Added
- new field "timeToLive" to DiscoveryEndpoint added, so that a time to live can be provided for the self registration at the DiscoveryFinder

## fixed

## 0.2.7
### Added

Expand All @@ -15,6 +21,7 @@ to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
- Spring Boot version updated to 3.1.6 to fix CVE-2023-46589 and CVE-2023-34053
- update logback version to fix CVE-2023-6378


## 0.2.6
### Added
- Introduced versioning of the APIs of the Discovery Services.First version of this API is 1.0
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,8 @@
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.validation.annotation.Validated;

import jakarta.validation.constraints.Max;
import jakarta.validation.constraints.Min;
import jakarta.validation.constraints.NotEmpty;
import jakarta.validation.constraints.NotNull;
import lombok.Data;
Expand All @@ -43,6 +45,10 @@ public class BpnDiscoveryProperties {

private final Idm idm = new Idm();

@Min( value = 1, message = "value must be greater or equal to 1" )
@Max( value = 31536000, message = "value must be lesser or equal to 31536000")
private Integer timeToLive;

/**
* Properties for Identity Management system
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,4 +47,6 @@ public class DiscoveryEndpoint {
@JsonProperty( "resourceId" )
private String resourceId;

@JsonProperty( "timeToLive" )
private Integer timeToLive;
}
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,8 @@ private DiscoveryEndpoint createDiscoveryEndpointRequest( String type ) {
.type( type )
.description( bpnDiscoveryProperties.getDescription() )
.endpointAddress( bpnDiscoveryProperties.getEndpointAddress() )
.documentation( bpnDiscoveryProperties.getDocumentation() ).build();
.documentation( bpnDiscoveryProperties.getDocumentation() )
.timeToLive( bpnDiscoveryProperties.getTimeToLive() )
.build();
}
}
1 change: 1 addition & 0 deletions backend/src/main/resources/application.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ bpndiscovery:
description:
endpointAddress:
documentation:
timeToLive:
idm:
public-client-id:
bpn-id-claim-name:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -107,13 +107,16 @@ public DiscoveryEndpoint dummyDiscoveryEndpoint() {
.endpointAddress( "http://localhost:8585" )
.documentation( "http://localhost:8585/swagger/index.html" )
.resourceId( "123-wxy" )
.timeToLive( 31536000 )
.build();
}

public DiscoveryEndpoint applicationDiscoveryEndpoint() {
return DiscoveryEndpoint.builder()
.type( bpnDiscoveryProperties.getAllowedTypes().get( 0 ) )
.description( bpnDiscoveryProperties.getDescription() )
.endpointAddress( bpnDiscoveryProperties.getEndpointAddress() )
.timeToLive( bpnDiscoveryProperties.getTimeToLive() )
.resourceId( "resourceId-app-1" )
.build();
}
Expand Down
1 change: 1 addition & 0 deletions backend/src/test/resources/application-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ bpndiscovery:
description: "Service to discover BPN to a particular OEN"
endpointAddress: "http://localhost:86866"
documentation: "http://.../swagger/index.html"
timeToLive: 31536000
idm:
public-client-id: bpndiscovery
bpn-id-claim-name: bpn
Expand Down
2 changes: 1 addition & 1 deletion charts/bpndiscovery/Chart.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ sources:
- https://github.com/eclipse-tractusx/sldt-bpn-discovery

type: application
version: 0.1.14
version: 0.1.15
appVersion: 0.2.7

dependencies:
Expand Down
85 changes: 43 additions & 42 deletions charts/bpndiscovery/README.md

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions charts/bpndiscovery/templates/secret.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ data:
BPNDISCOVERY_ALLOWED_TYPES: {{ .Values.bpndiscovery.bpndiscoveryEndpoint.allowedTypes | b64enc }}
BPNDISCOVERY_DESCRIPTION: {{ .Values.bpndiscovery.bpndiscoveryEndpoint.description | b64enc }}
BPNDISCOVERY_ENDPOINT_ADDRESS: {{ .Values.bpndiscovery.bpndiscoveryEndpoint.endpointAddress | b64enc }}
BPNDISCOVERY_TIME_TO_LIVE: {{ .Values.bpndiscovery.bpndiscoveryEndpoint.timeToLive | toString | b64enc }}
BPNDISCOVERY_DOCUMENTATION: {{ .Values.bpndiscovery.bpndiscoveryEndpoint.documentation | b64enc }}
BPNDISCOVERY_IDM_PUBLIC_CLIENT_ID: {{ .Values.bpndiscovery.idp.publicClientId | b64enc }}
BPNDISCOVERY_IDM_BPN_ID_CLAIM_NAME: {{ .Values.bpndiscovery.idp.bpnIdClaimName | b64enc }}
Expand Down
1 change: 1 addition & 0 deletions charts/bpndiscovery/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ bpndiscovery:
description: "bpndiscovery"
endpointAddress: "/bpndiscovery"
documentation: "/bpndiscovery/swagger/index.html"
timeToLive: 31536000
## Configure discoveryFinderClient to register the bpn-discovery on discovery-finder.Properties needed for spring-security config.
discoveryfinderClient:
baseUrl: "/discoveryfinder"
Expand Down
2 changes: 1 addition & 1 deletion docs/3-system-scope-and-context.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
|------------------|--------------------------------------------------------------------------|
| Consumer App | Requests for BPN with an type and type number |
| Data Provider | Requests for register or delete entries from BPN Discovery |
| Discovery Finder | Receives request from BPN Discovey of self-registration purpose |
| Discovery Finder | Receives request from BPN Discovery of self-registration purpose |
| Keycloak | Generates token for users and provides id management of user and service |


Expand Down

0 comments on commit 5219305

Please sign in to comment.