File tree Expand file tree Collapse file tree 1 file changed +8
-1
lines changed
pic-sure-auth-services/src/main/java/edu/harvard/hms/dbmi/avillach/auth/rest Expand file tree Collapse file tree 1 file changed +8
-1
lines changed Original file line number Diff line number Diff line change 3
3
import edu .harvard .hms .dbmi .avillach .auth .service .impl .authorization .AuthorizationService ;
4
4
import io .swagger .v3 .oas .annotations .Parameter ;
5
5
import org .springframework .beans .factory .annotation .Autowired ;
6
+ import org .springframework .beans .factory .annotation .Value ;
6
7
import org .springframework .http .ResponseEntity ;
7
8
import org .springframework .stereotype .Controller ;
8
9
import org .springframework .web .bind .annotation .RequestBody ;
15
16
public class OpenAccessController {
16
17
17
18
private final AuthorizationService authorizationService ;
19
+ private final boolean openIdpProviderIsEnabled ;
18
20
19
21
@ Autowired
20
- public OpenAccessController (AuthorizationService authorizationService ) {
22
+ public OpenAccessController (AuthorizationService authorizationService , @ Value ( "${open.idp.provider.is.enabled}" ) boolean openIdpProviderIsEnabled ) {
21
23
this .authorizationService = authorizationService ;
24
+ this .openIdpProviderIsEnabled = openIdpProviderIsEnabled ;
22
25
}
23
26
24
27
@ RequestMapping (value = "/validate" , produces = "application/json" )
25
28
public ResponseEntity <?> validate (@ Parameter (required = true , description = "A JSON object that at least" +
26
29
" include a user the token for validation" )
27
30
@ RequestBody Map <String , Object > inputMap ) {
31
+ if (!openIdpProviderIsEnabled ) {
32
+ return ResponseEntity .ok (false );
33
+ }
34
+
28
35
boolean isValid = authorizationService .openAccessRequestIsValid (inputMap );
29
36
return ResponseEntity .ok (isValid );
30
37
}
You can’t perform that action at this time.
0 commit comments