-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Separere sikkerhet, ta i bruk Kontekst (#1245)
* Separere sikkerhet, ta i bruk Kontekst * Flere forbedringer * Et par ting relatert til zero trust
- Loading branch information
Showing
76 changed files
with
883 additions
and
512 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<project xmlns="http://maven.apache.org/POM/4.0.0" | ||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" | ||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> | ||
<parent> | ||
<artifactId>felles</artifactId> | ||
<groupId>no.nav.foreldrepenger.felles</groupId> | ||
<version>0.0.0-SNAPSHOT</version> | ||
</parent> | ||
<modelVersion>4.0.0</modelVersion> | ||
|
||
<artifactId>felles-abac-kontekst</artifactId> | ||
<name>Felles :: ABAC</name> | ||
|
||
<dependencies> | ||
<dependency> | ||
<groupId>no.nav.foreldrepenger.felles</groupId> | ||
<artifactId>felles-kontekst</artifactId> | ||
</dependency> | ||
<dependency> | ||
<groupId>no.nav.foreldrepenger.felles</groupId> | ||
<artifactId>felles-oidc</artifactId> | ||
</dependency> | ||
<dependency> | ||
<groupId>no.nav.foreldrepenger.felles</groupId> | ||
<artifactId>felles-abac</artifactId> | ||
</dependency> | ||
</dependencies> | ||
|
||
</project> |
39 changes: 39 additions & 0 deletions
39
...ac-kontekst/src/main/java/no/nav/foreldrepenger/sikkerhet/abac/KontekstTokenProvider.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,39 @@ | ||
package no.nav.foreldrepenger.sikkerhet.abac; | ||
|
||
import javax.enterprise.context.Dependent; | ||
|
||
import no.nav.vedtak.sikkerhet.abac.TokenProvider; | ||
import no.nav.vedtak.sikkerhet.kontekst.DefaultRequestKontekstProvider; | ||
import no.nav.vedtak.sikkerhet.kontekst.IdentType; | ||
import no.nav.vedtak.sikkerhet.kontekst.RequestKontekst; | ||
import no.nav.vedtak.sikkerhet.kontekst.RequestKontekstProvider; | ||
import no.nav.vedtak.sikkerhet.kontekst.WsRequestKontekst; | ||
import no.nav.vedtak.sikkerhet.oidc.token.OpenIDToken; | ||
|
||
@Dependent | ||
public class KontekstTokenProvider implements TokenProvider { | ||
|
||
private static final RequestKontekstProvider PROVIDER = new DefaultRequestKontekstProvider(); | ||
|
||
@Override | ||
public String getUid() { | ||
return PROVIDER.getKontekst().getUid(); | ||
} | ||
|
||
@Override | ||
public IdentType getIdentType() { | ||
return PROVIDER.getKontekst().getIdentType(); | ||
} | ||
|
||
@Override | ||
public OpenIDToken openIdToken() { | ||
var kontekst = PROVIDER.getKontekst(); | ||
return kontekst instanceof RequestKontekst rk ? rk.getToken() : null; | ||
} | ||
|
||
@Override | ||
public String samlToken() { | ||
var kontekst = PROVIDER.getKontekst(); | ||
return kontekst instanceof WsRequestKontekst wrk ? wrk.getSamlTokenAsString() : null; | ||
} | ||
} |
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 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<beans xmlns="http://xmlns.jcp.org/xml/ns/javaee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" | ||
xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/javaee http://xmlns.jcp.org/xml/ns/javaee/beans_2_0.xsd" | ||
version="2.0" | ||
bean-discovery-mode="annotated"> | ||
</beans> |
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
Oops, something went wrong.