-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #54 from navikt/dev/sikkerhetsmodul
Dev/sikkerhetsmodul
- Loading branch information
Showing
41 changed files
with
675 additions
and
32 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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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,3 @@ | ||
# Sikkerhetsmodul | ||
|
||
Felles sikkerhetsmodul for autentisering og autorisering. |
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,24 @@ | ||
plugins { | ||
kotlin("jvm") | ||
} | ||
|
||
dependencies { | ||
implementation(project(":lib:error-handling")) | ||
implementation(libs.ktor.server.auth) | ||
implementation(libs.logbackClassic) | ||
implementation(libs.nav.security.tokenValidationKtorV2) | ||
|
||
//Test | ||
testImplementation(project(":lib:pdl-client")) | ||
testImplementation(libs.nav.poao.tilgangClient) | ||
testImplementation(libs.nav.security.mockOauth2Server) | ||
testImplementation(libs.bundles.testLibsWithUnitTesting) | ||
testImplementation(libs.ktor.server.testJvm) | ||
testImplementation(libs.ktor.client.contentNegotiation) | ||
testImplementation(libs.ktor.serialization.jackson) | ||
testImplementation(libs.jackson.datatypeJsr310) | ||
} | ||
|
||
tasks.withType<Test>().configureEach { | ||
useJUnitPlatform() | ||
} |
6 changes: 6 additions & 0 deletions
6
...c/main/kotlin/no/nav/paw/security/authentication/exception/BearerTokenManglerException.kt
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,6 @@ | ||
package no.nav.paw.security.authentication.exception | ||
|
||
import no.nav.paw.error.exception.AuthenticationException | ||
|
||
class BearerTokenManglerException(message: String) : | ||
AuthenticationException("PAW_BEARER_TOKEN_MANGLER", message) |
6 changes: 6 additions & 0 deletions
6
...ity/src/main/kotlin/no/nav/paw/security/authentication/exception/IngenTilgangException.kt
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,6 @@ | ||
package no.nav.paw.security.authentication.exception | ||
|
||
import no.nav.paw.error.exception.AuthorizationException | ||
|
||
class IngenTilgangException(message: String) : | ||
AuthorizationException("PAW_INGEN_TILGANG", message) |
6 changes: 6 additions & 0 deletions
6
...c/main/kotlin/no/nav/paw/security/authentication/exception/UgyldigBearerTokenException.kt
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,6 @@ | ||
package no.nav.paw.security.authentication.exception | ||
|
||
import no.nav.paw.error.exception.AuthorizationException | ||
|
||
class UgyldigBearerTokenException(message: String) : | ||
AuthorizationException("PAW_UGYLDIG_BEARER_TOKEN", message) |
6 changes: 6 additions & 0 deletions
6
...ty/src/main/kotlin/no/nav/paw/security/authentication/exception/UgyldigBrukerException.kt
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,6 @@ | ||
package no.nav.paw.security.authentication.exception | ||
|
||
import no.nav.paw.error.exception.AuthorizationException | ||
|
||
class UgyldigBrukerException(message: String) : | ||
AuthorizationException("PAW_UGYLDIG_BRUKER", message) |
11 changes: 11 additions & 0 deletions
11
lib/security/src/main/kotlin/no/nav/paw/security/authentication/model/Bruker.kt
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,11 @@ | ||
package no.nav.paw.security.authentication.model | ||
|
||
import java.util.* | ||
|
||
sealed class Bruker<ID : Any>( | ||
open val ident: ID | ||
) | ||
|
||
data class Sluttbruker(override val ident: Identitetsnummer) : Bruker<Identitetsnummer>(ident) | ||
data class NavAnsatt(val oid: UUID, override val ident: String) : Bruker<String>(ident) | ||
data class M2MToken(val oid: UUID) : Bruker<String>("N/A") |
10 changes: 10 additions & 0 deletions
10
lib/security/src/main/kotlin/no/nav/paw/security/authentication/model/Identitetsnummer.kt
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,10 @@ | ||
package no.nav.paw.security.authentication.model | ||
|
||
@JvmInline | ||
value class Identitetsnummer(val verdi: String) { | ||
override fun toString(): String { | ||
return "*".repeat(verdi.length) | ||
} | ||
} | ||
|
||
fun String.asIdentitetsnummer(): Identitetsnummer = Identitetsnummer(this) |
Oops, something went wrong.