-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: The authentication tokens (JWT) now retain their validity beyon…
…d the restart of the IRIS client. This means that, ideally, users notice only little of a restart of the application. If no secrets for JWT have been set via external properties, then secure ones are automatically generated and stored in the database. This means that the secrets and the JWTs are retained beyond the restart. After a configurable duration (default: 3 months) they are renewed. PR #804
- Loading branch information
1 parent
b20ed86
commit 2442685
Showing
7 changed files
with
122 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
40 changes: 40 additions & 0 deletions
40
iris-client-bff/src/main/java/iris/client_bff/core/settings/Setting.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
package iris.client_bff.core.settings; | ||
|
||
import lombok.AllArgsConstructor; | ||
import lombok.Data; | ||
import lombok.NoArgsConstructor; | ||
|
||
import java.time.LocalDate; | ||
|
||
import javax.persistence.Column; | ||
import javax.persistence.Entity; | ||
import javax.persistence.EnumType; | ||
import javax.persistence.Enumerated; | ||
import javax.persistence.Id; | ||
import javax.persistence.Table; | ||
import javax.validation.constraints.Size; | ||
|
||
/** | ||
* @author Jens Kutzsche | ||
*/ | ||
@Entity | ||
@Table(name = "settings") | ||
@Data | ||
@AllArgsConstructor | ||
@NoArgsConstructor | ||
public class Setting { | ||
|
||
@Id | ||
@Enumerated(EnumType.STRING) | ||
@Column(nullable = false) | ||
private Name name; | ||
|
||
@Size(max = 1000) | ||
private String storedValue; // value is a keyword for DBMS | ||
|
||
private LocalDate savedAt = LocalDate.now(); | ||
|
||
public enum Name { | ||
JWT_SECRET, REFRESH_SECRET; | ||
} | ||
} |
5 changes: 5 additions & 0 deletions
5
iris-client-bff/src/main/java/iris/client_bff/core/settings/SettingsRepository.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
package iris.client_bff.core.settings; | ||
|
||
import org.springframework.data.jpa.repository.JpaRepository; | ||
|
||
public interface SettingsRepository extends JpaRepository<Setting, Setting.Name> {} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
5 changes: 5 additions & 0 deletions
5
iris-client-bff/src/main/resources/db/migration/V1014__add_settings.sql
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
CREATE TABLE settings ( | ||
name varchar(50) primary key, | ||
stored_value varchar(1000) NOT NULL, | ||
saved_at date NOT NULL | ||
); |
5 changes: 5 additions & 0 deletions
5
iris-client-bff/src/main/resources/db/migration_mssql/V1014__add_settings.sql
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
CREATE TABLE settings ( | ||
name varchar(50) primary key, | ||
stored_value varchar(1000) NOT NULL, | ||
saved_at date NOT NULL | ||
); |
5 changes: 5 additions & 0 deletions
5
iris-client-bff/src/main/resources/db/migration_mysql/V1014__add_settings.sql
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
CREATE TABLE settings ( | ||
name varchar(50) primary key, | ||
stored_value varchar(1000) NOT NULL, | ||
saved_at date NOT NULL | ||
); |