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