a simple validator for validation a norwegian social security numbers (FNR, DNR)
See Fødselsnummer for more info on how validation of a norwegian social security number is done
- Kotlin
- Gradle
- JDK 21
The package in this repo is uploaded to the GitHub Package Registry which requires authentication. It can, for example, be solved like this in Gradle:
val githubUser: String by project
val githubPassword: String by project
repositories {
maven {
credentials {
username = githubUser
password = githubPassword
}
setUrl("https://maven.pkg.github.com/mikaojk/norwegian-social-security-number-validator")
}
}
githubUser
and githubPassword
can be put into a separate file ~/.gradle/gradle.properties
with the following content:
githubUser=x-access-token
githubPassword=[token]
Replace [token]
with a personal access token with scope read:packages
.
See githubs guide creating-a-personal-access-token on
how to create a personal access token.
Alternatively, the variables can be configured via environment variables:
ORG_GRADLE_PROJECT_githubUser
ORG_GRADLE_PROJECT_githubPassword
or the command line:
./gradlew -PgithubUser=x-access-token -PgithubPassword=[token]
Gradle(kotlin)
implementation("io.github.mikaojk:norwegian-social-security-number-validator:2.0.9")
Maven
<dependency>
<groupId>io.github.mikaojk</groupId>
<artifactId>norwegian-social-security-number-validator</artifactId>
<version>2.0.9</version>
</dependency>
val valid = validateSocialSecurityAndDNumber11Digits("01013999900")
Make sure you have the Java JDK 21 installed You can check which version you have installed using this command:
java -version
To build locally and run the integration tests you can simply run
./gradlew clean build
or on windows
gradlew.bat clean build
Find the newest version of gradle here: https://gradle.org/releases/ Then run this command:
./gradlew wrapper --gradle-version $gradleVersjon
To publish you can simply run
./gradlew clean build
for release to GitHub packages run (Replace $NEW_VERSION with the version you want to release)
./gradlew -Pversion=$NEW_VERSION publish
for release to GitHub packages run (Replace $NEW_VERSION with the version you want to release)
./gradlew -Pversion=$NEW_VERSION jreleaserFullRelease
Artifact publish is done by GitHub Actions, and publish to Maven Central and GitHub Packages
This project is maintained by CODEOWNERS
Questions and/or feature requests? Please create an issue
To get started, please fork the repo and checkout a new branch. See more info in CONTRIBUTING.md