4
4
import cz .muni .ics .oauth2 .model .DeviceCode ;
5
5
import cz .muni .ics .oauth2 .service .SystemScopeService ;
6
6
import cz .muni .ics .oauth2 .web .DeviceEndpoint ;
7
- import cz .muni .ics .oidc .server .PerunDeviceCodeAcrRepository ;
8
7
import cz .muni .ics .oidc .server .PerunScopeClaimTranslationService ;
9
8
import cz .muni .ics .oidc .server .configurations .PerunOidcConfig ;
10
9
import cz .muni .ics .oidc .server .filters .PerunFilterConstants ;
11
10
import cz .muni .ics .oidc .server .userInfo .PerunUserInfo ;
12
11
import cz .muni .ics .oidc .web .WebHtmlClasses ;
13
12
import cz .muni .ics .oidc .web .langs .Localization ;
14
- import cz .muni .ics .openid .connect .models .DeviceCodeAcr ;
15
13
import cz .muni .ics .openid .connect .service .UserInfoService ;
16
14
import java .security .Principal ;
17
- import java .time .Instant ;
18
15
import java .util .Map ;
19
16
import javax .servlet .http .HttpServletRequest ;
20
17
import javax .servlet .http .HttpSession ;
@@ -41,7 +38,6 @@ public class ApproveDeviceController {
41
38
public static final String DEVICE_APPROVED = "deviceApproved" ;
42
39
public static final String REQUEST_USER_CODE = "requestUserCode" ;
43
40
public static final String USER_CODE = "user_code" ;
44
- public static final String DEVICE_CODE = "device_code" ;
45
41
public static final String USER_OAUTH_APPROVAL = "user_oauth_approval" ;
46
42
public static final String URL = "devicecode" ;
47
43
public static final String VERIFICATION_URI = "verification_uri" ;
@@ -59,7 +55,6 @@ public class ApproveDeviceController {
59
55
private final WebHtmlClasses htmlClasses ;
60
56
private final PerunScopeClaimTranslationService scopeClaimTranslationService ;
61
57
private final UserInfoService userInfoService ;
62
- private final PerunDeviceCodeAcrRepository deviceCodeAcrRepository ;
63
58
64
59
@ Autowired
65
60
public ApproveDeviceController (SystemScopeService scopeService ,
@@ -68,8 +63,7 @@ public ApproveDeviceController(SystemScopeService scopeService,
68
63
Localization localization ,
69
64
WebHtmlClasses htmlClasses ,
70
65
PerunScopeClaimTranslationService scopeClaimTranslationService ,
71
- UserInfoService userInfoService ,
72
- PerunDeviceCodeAcrRepository perunDeviceCodeAcrRepository )
66
+ UserInfoService userInfoService )
73
67
{
74
68
this .scopeService = scopeService ;
75
69
this .deviceEndpoint = deviceEndpoint ;
@@ -78,7 +72,6 @@ public ApproveDeviceController(SystemScopeService scopeService,
78
72
this .htmlClasses = htmlClasses ;
79
73
this .scopeClaimTranslationService = scopeClaimTranslationService ;
80
74
this .userInfoService = userInfoService ;
81
- this .deviceCodeAcrRepository = perunDeviceCodeAcrRepository ;
82
75
}
83
76
84
77
@ RequestMapping (
@@ -96,7 +89,6 @@ public String requestDeviceCodeMFA(@RequestParam(CLIENT_ID) String clientId, @Re
96
89
Map <String , Object > response = (Map <String , Object >) model .get (ENTITY );
97
90
response .replace (VERIFICATION_URI , response .get (VERIFICATION_URI ) + "?" + ACR_VALUES + "=" + acrValues );
98
91
response .replace (VERIFICATION_URI_COMPLETE , response .get (VERIFICATION_URI_COMPLETE ) + "&" + ACR_VALUES + "=" + acrValues );
99
- storeAcrBase ((String ) response .get (DEVICE_CODE ), (String )response .get (USER_CODE ));
100
92
101
93
return result ;
102
94
}
@@ -145,10 +137,6 @@ public String readUserCode(@RequestParam(USER_CODE) String userCode,
145
137
{
146
138
String result = deviceEndpoint .readUserCode (userCode , model , session );
147
139
if (result .equals (APPROVE_DEVICE ) && !perunOidcConfig .getTheme ().equalsIgnoreCase ("default" )) {
148
- if (StringUtils .hasText (req .getParameter (ACR ))) {
149
- storeAcr (req .getParameter (ACR ), userCode );
150
- }
151
-
152
140
return themedApproveDevice (model , p , req );
153
141
} else if (result .equals (REQUEST_USER_CODE ) && !perunOidcConfig .getTheme ().equalsIgnoreCase ("default" )) {
154
142
ControllerUtils .setPageOptions (model , req , localization , htmlClasses , perunOidcConfig );
@@ -189,14 +177,6 @@ public String approveDevice(@RequestParam(USER_CODE) String userCode,
189
177
return result ;
190
178
}
191
179
192
- private void storeAcr (String acrValue , String userCode ) {
193
- DeviceCodeAcr acr = deviceCodeAcrRepository .getByUserCode (userCode );
194
- acr .setShibAuthnContextClass (acrValue );
195
- long expiresAtEpoch = Instant .now ().plusSeconds (600L ).toEpochMilli ();
196
- acr .setExpiresAt (expiresAtEpoch );
197
- deviceCodeAcrRepository .store (acr );
198
- }
199
-
200
180
private String themedApproveDevice (ModelMap model , Principal p , HttpServletRequest req ) {
201
181
model .remove ("scopes" );
202
182
DeviceCode dc = (DeviceCode ) model .get ("dc" );
@@ -210,10 +190,4 @@ private String themedApproveDevice(ModelMap model, Principal p, HttpServletReque
210
190
return "themedApproveDevice" ;
211
191
}
212
192
213
- private void storeAcrBase (String deviceCode , String userCode ) {
214
- DeviceCodeAcr acrBase = new DeviceCodeAcr (deviceCode , userCode );
215
- acrBase .setExpiresAt (Instant .now ().plusSeconds (1800 ).toEpochMilli ());
216
- deviceCodeAcrRepository .store (acrBase );
217
- }
218
-
219
193
}
0 commit comments