@@ -618,30 +618,32 @@ public void processOperation(String resourcePath, String httpMethod, Operation o
618
618
// https://github.com/OAI/OpenAPI-Specification/blob/master/versions/2.0.md#swagger-object
619
619
// "there is a logical OR between the security requirements"
620
620
if (securities .size () > 1 ) {
621
- LOGGER .warn ("More than 1 security requirements are found, using only the first one" );
621
+ // LOGGER.warn("More than 1 security requirements are found, using only the first one");
622
622
}
623
- Map <String , List <String >> security = securities .get (0 );
624
- for (String securityName : security .keySet ()) {
625
- SecuritySchemeDefinition securityDefinition = fromSecurity (securityName );
626
- if (securityDefinition != null ) {
627
- if (securityDefinition instanceof OAuth2Definition ) {
628
- OAuth2Definition oauth2Definition = (OAuth2Definition ) securityDefinition ;
629
- OAuth2Definition oauth2Operation = new OAuth2Definition ();
630
- oauth2Operation .setType (oauth2Definition .getType ());
631
- oauth2Operation .setAuthorizationUrl (oauth2Definition .getAuthorizationUrl ());
632
- oauth2Operation .setFlow (oauth2Definition .getFlow ());
633
- oauth2Operation .setTokenUrl (oauth2Definition .getTokenUrl ());
634
- oauth2Operation .setScopes (new HashMap <String , String >());
635
- for (String scope : security .get (securityName )) {
636
- if (oauth2Definition .getScopes ().containsKey (scope )) {
637
- oauth2Operation .addScope (scope , oauth2Definition .getScopes ().get (scope ));
638
- }
639
- }
640
- authMethods .put (securityName , oauth2Operation );
641
- } else {
642
- authMethods .put (securityName , securityDefinition );
643
- }
644
- }
623
+ //Map<String, List<String>> security = securities.get(0);
624
+ for (Map <String , List <String >> security : securities ) {
625
+ for (String securityName : security .keySet ()) {
626
+ SecuritySchemeDefinition securityDefinition = fromSecurity (securityName );
627
+ if (securityDefinition != null ) {
628
+ if (securityDefinition instanceof OAuth2Definition ) {
629
+ OAuth2Definition oauth2Definition = (OAuth2Definition ) securityDefinition ;
630
+ OAuth2Definition oauth2Operation = new OAuth2Definition ();
631
+ oauth2Operation .setType (oauth2Definition .getType ());
632
+ oauth2Operation .setAuthorizationUrl (oauth2Definition .getAuthorizationUrl ());
633
+ oauth2Operation .setFlow (oauth2Definition .getFlow ());
634
+ oauth2Operation .setTokenUrl (oauth2Definition .getTokenUrl ());
635
+ oauth2Operation .setScopes (new HashMap <String , String >());
636
+ for (String scope : security .get (securityName )) {
637
+ if (oauth2Definition .getScopes ().containsKey (scope )) {
638
+ oauth2Operation .addScope (scope , oauth2Definition .getScopes ().get (scope ));
639
+ }
640
+ }
641
+ authMethods .put (securityName , oauth2Operation );
642
+ } else {
643
+ authMethods .put (securityName , securityDefinition );
644
+ }
645
+ }
646
+ }
645
647
}
646
648
if (!authMethods .isEmpty ()) {
647
649
co .authMethods = config .fromSecurity (authMethods );
0 commit comments