-
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.
Legacy token provider for back kompabilitet (#773)
* Legacy token provider - oppdatert README. * Fjerner rester av den gamle sporingslogg.
- Loading branch information
Showing
9 changed files
with
121 additions
and
22 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,53 @@ | ||
<?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-legacy</artifactId> | ||
<name>Felles :: ABAC</name> | ||
|
||
<dependencies> | ||
<dependency> | ||
<groupId>no.nav.foreldrepenger.felles.sikkerhet</groupId> | ||
<artifactId>felles-sikkerhet</artifactId> | ||
<exclusions> | ||
<exclusion> | ||
<groupId>no.nav.foreldrepenger.felles</groupId> | ||
<artifactId>felles-feil</artifactId> | ||
</exclusion> | ||
<exclusion> | ||
<groupId>no.nav.foreldrepenger.felles</groupId> | ||
<artifactId>felles-log</artifactId> | ||
</exclusion> | ||
<exclusion> | ||
<groupId>no.nav.foreldrepenger.felles</groupId> | ||
<artifactId>felles-util</artifactId> | ||
</exclusion> | ||
</exclusions> | ||
</dependency> | ||
<dependency> | ||
<groupId>no.nav.foreldrepenger.felles</groupId> | ||
<artifactId>felles-abac</artifactId> | ||
<exclusions> | ||
<exclusion> | ||
<groupId>no.nav.foreldrepenger.felles</groupId> | ||
<artifactId>felles-feil</artifactId> | ||
</exclusion> | ||
<exclusion> | ||
<groupId>no.nav.foreldrepenger.felles</groupId> | ||
<artifactId>felles-log</artifactId> | ||
</exclusion> | ||
<exclusion> | ||
<groupId>no.nav.foreldrepenger.felles</groupId> | ||
<artifactId>felles-util</artifactId> | ||
</exclusion> | ||
</exclusions> | ||
</dependency> | ||
</dependencies> | ||
</project> |
22 changes: 22 additions & 0 deletions
22
...s/abac-legacy/src/main/java/no/nav/foreldrepenger/sikkerhet/abac/LegacyTokenProvider.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,22 @@ | ||
package no.nav.foreldrepenger.sikkerhet.abac; | ||
|
||
import javax.enterprise.context.Dependent; | ||
|
||
import no.nav.vedtak.sikkerhet.abac.TokenProvider; | ||
import no.nav.vedtak.sikkerhet.context.SubjectHandler; | ||
|
||
@Dependent | ||
public class LegacyTokenProvider implements TokenProvider { | ||
|
||
public String getUid() { | ||
return SubjectHandler.getSubjectHandler().getUid(); | ||
} | ||
|
||
public String userToken() { | ||
return SubjectHandler.getSubjectHandler().getInternSsoToken(); | ||
} | ||
|
||
public String samlToken() { | ||
return SubjectHandler.getSubjectHandler().getSamlToken().getTokenAsString(); | ||
} | ||
} |
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
6 changes: 2 additions & 4 deletions
6
felles/abac/src/main/java/no/nav/vedtak/sikkerhet/abac/AbacAttributtType.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 |
---|---|---|
@@ -1,9 +1,7 @@ | ||
package no.nav.vedtak.sikkerhet.abac; | ||
|
||
import no.nav.vedtak.log.sporingslogg.SporingsloggId; | ||
|
||
public interface AbacAttributtType extends SporingsloggId { | ||
public interface AbacAttributtType { | ||
|
||
boolean getMaskerOutput(); | ||
|
||
} | ||
} |
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
18 changes: 17 additions & 1 deletion
18
felles/abac/src/main/java/no/nav/vedtak/sikkerhet/abac/TokenProvider.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 |
---|---|---|
@@ -1,11 +1,27 @@ | ||
package no.nav.vedtak.sikkerhet.abac; | ||
|
||
/** | ||
* Interface brukes til å provide informasjon om brukeren som forespør tilgang til en ressurs i en applikasjon. | ||
*/ | ||
public interface TokenProvider { | ||
|
||
/** | ||
* Identifikator til brukeren. Brukes i auditlogging. | ||
* @return bruker id. | ||
*/ | ||
String getUid(); | ||
|
||
/** | ||
* OIDC tokenet til brukeren. Helst fra følgende providere: Tokendings, AzureAD, STS, OpenAM. | ||
* Sendes til PDP (Policy Decision Point) og gir informasjon til ABAC om subject og auth level. | ||
* @return bruker OIDC token. | ||
*/ | ||
String userToken(); | ||
|
||
/** | ||
* SAML tokenet til brukeren. Trenges ved kall fra WebService grensesnitt. | ||
* Sendes til PDP (Policy Decision Point) og gir informasjon til ABAC om subject og auth level. | ||
* @return bruker SAML token. | ||
*/ | ||
String samlToken(); | ||
|
||
} |
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