Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Renamed PII to SensitiveDataHolder and improved docs #13

Merged
merged 2 commits into from
Sep 27, 2021
Merged
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
18 changes: 18 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,23 @@

This small project only serves as a shared library for Configuration classes and Annotations needed for Data Protection Projects in general.

---

It contains only 2 files, one for Annotations and another for Configs. The most important one for external users are the Annotations as that is what you would add to your Events.

### Annotations:
- `SensitiveDataHolder`
- Annotation to mark a class/event that contains any Sensitive Data field on it
- `SensitiveData`
- Annotation to mark a field that is a Sensitive Data. Default is an empty string.
- `SubjectId`
- Annotation to mark a field that is the Subject ID for a given `SensitiveDataHolder`

### Configs:
- `DataProtectionConfigList`
- `DataProtectionConfig`
- `SensitiveDataConfig`
- `SubjectIdConfig`

---
Created with :heart: by [AxonIQ](https://axoniq.io/)
Original file line number Diff line number Diff line change
Expand Up @@ -16,16 +16,25 @@

package io.axoniq.plugin.data.protection.annotation

/**
* Represents a class which holds Sensitive Data on it. Used to easily scan the Events what contains Sensitive Data.
*/
@Retention(AnnotationRetention.RUNTIME)
@Target(AnnotationTarget.ANNOTATION_CLASS, AnnotationTarget.CLASS)
annotation class PII
annotation class SensitiveDataHolder

/**
* Represents a field that contains Sensitive Data. The default value for replacement value is an empty string.
*/
@Retention(AnnotationRetention.RUNTIME)
@Target(AnnotationTarget.FIELD)
annotation class SensitiveData(
val replacementValue: String
val replacementValue: String = ""
)

/**
* Represents the Subject ID, which usually is the key for Sensitive Data fields.
*/
@Retention(AnnotationRetention.RUNTIME)
@Target(AnnotationTarget.FIELD)
annotation class SubjectId
15 changes: 15 additions & 0 deletions src/main/kotlin/io/axoniq/plugin/data/protection/config/configs.kt
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,19 @@

package io.axoniq.plugin.data.protection.config

/**
* Simple alias to indicate a given String is a Json Path.
*/
typealias Path = String

/**
* List container for [DataProtectionConfig].
*/
data class DataProtectionConfigList(val config: List<DataProtectionConfig> = listOf())

/**
* Represents the config as an input.
*/
data class DataProtectionConfig(
val type: String,
val revision: String,
Expand All @@ -34,11 +43,17 @@ data class DataProtectionConfig(
)
}

/**
* Represents each Sensitive Data configuration with its path and replacement value.
*/
data class SensitiveDataConfig(
val path: Path,
val replacementValue: String?
)

/**
* Represents the Subject ID, which usually is the key for Sensitive Data fields.
*/
data class SubjectIdConfig(
val path: Path,
)