@@ -50,12 +50,6 @@ public String getKonsumentId() {
50
50
return konsumentId ;
51
51
}
52
52
53
- // Brukes kun i abakus / dignostikk. Sjekk om kan endres til forProsesstaskUtenSystembruker
54
- @ Deprecated (forRemoval = true ) // Erstatt med forProsesstaskUtenSystembruker
55
- public static BasisKontekst forProsesstask () {
56
- return new BasisKontekst (SikkerhetContext .SYSTEM , Systembruker .username (), IdentType .Prosess , Systembruker .username ());
57
- }
58
-
59
53
// Denne brukes i prosesstask
60
54
public static BasisKontekst forProsesstaskUtenSystembruker () {
61
55
var username = "srv" + Optional .ofNullable (Environment .current ().application ()).orElse ("local" );
@@ -64,15 +58,14 @@ public static BasisKontekst forProsesstaskUtenSystembruker() {
64
58
}
65
59
66
60
public static BasisKontekst ikkeAutentisertRequest (String consumerId ) {
67
- return new BasisKontekst (SikkerhetContext .REQUEST , null , null , ensureCunsumerId (consumerId ));
61
+ var consumer = Optional .ofNullable (consumerId )
62
+ .or (() -> Optional .ofNullable (Environment .current ().application ()).map (a -> "srv" + a ))
63
+ .orElse ("srvlocal" );
64
+ return new BasisKontekst (SikkerhetContext .REQUEST , null , null , consumer );
68
65
}
69
66
70
67
static BasisKontekst tomKontekst () {
71
68
return new BasisKontekst (null , null , null , null );
72
69
}
73
70
74
- protected static String ensureCunsumerId (String consumerId ) {
75
- return consumerId != null ? consumerId : Systembruker .username ();
76
- }
77
-
78
71
}
0 commit comments