if (oauth2Scheme.getScopes() != null && !oauth2Scheme.getScopes().isEmpty()) { StringColumn.Builder nameColumnBuilder = StringColumn.builder(StringColumnId.of(labels.getLabel(NAME_COLUMN))) .putMetaData(TableComponent.WIDTH_RATIO, "3") .putMetaData(TableComponent.HEADER_COLUMN, "true"); for (Map.Entry<String, String> scope : oauth2Scheme.getScopes().entrySet()) { nameColumnBuilder.add(scope.getKey()); descriptionColumnBuilder.add(scope.getValue());
@Override protected BiFunction<Swagger, ConfigurationProperty, Optional<ConfigurationProperty>> propertyValueExtractor() { return (swagger, template) -> oauthProperty(swagger, template, d -> d.getScopes().keySet().stream().collect(Collectors.joining(" "))); } },
@Override protected BiFunction<Swagger, ConfigurationProperty, Optional<ConfigurationProperty>> propertyValueExtractor() { return (swagger, template) -> oauthProperty(swagger, template, d -> d.getScopes().keySet().stream().collect(Collectors.joining(" "))); } },
@Override protected BiFunction<Swagger, ConfigurationProperty, Optional<ConfigurationProperty>> propertyValueExtractor() { return (swagger, template) -> oauthProperty(swagger, template, d -> d.getScopes().keySet().stream().collect(Collectors.joining(" "))); } },
@Override protected BiFunction<Swagger, ConfigurationProperty, Optional<ConfigurationProperty>> propertyValueExtractor() { return (swagger, template) -> oauthProperty(swagger, template, d -> d.getScopes().keySet().stream().collect(Collectors.joining(" "))); } },
@Override public Map<String, String> getScopesFromSecurityDefinition(String resourceConfigJSON) throws APIManagementException { SwaggerParser swaggerParser = new SwaggerParser(); Swagger swagger = swaggerParser.parse(resourceConfigJSON); Map<String, String> scopes = new HashMap<>(); Map<String, SecuritySchemeDefinition> securityDefinitions = swagger.getSecurityDefinitions(); if (securityDefinitions != null) { for (Map.Entry<String, SecuritySchemeDefinition> securitySchemeDefinitionEntry : securityDefinitions.entrySet()) { if (securitySchemeDefinitionEntry.getValue() instanceof OAuth2Definition) { OAuth2Definition securityDefinition = (OAuth2Definition) securitySchemeDefinitionEntry.getValue(); if (securityDefinition != null) { scopes.putAll(securityDefinition.getScopes()); } } } } return scopes; }
@Override public Map<String, String> getScopesFromSecurityDefinition(String resourceConfigJSON) throws APIManagementException { SwaggerParser swaggerParser = new SwaggerParser(); Swagger swagger = swaggerParser.parse(resourceConfigJSON); Map<String, String> scopes = new HashMap<>(); Map<String, SecuritySchemeDefinition> securityDefinitions = swagger.getSecurityDefinitions(); if (securityDefinitions != null) { for (Map.Entry<String, SecuritySchemeDefinition> securitySchemeDefinitionEntry : securityDefinitions.entrySet()) { if (securitySchemeDefinitionEntry.getValue() instanceof OAuth2Definition) { OAuth2Definition securityDefinition = (OAuth2Definition) securitySchemeDefinitionEntry.getValue(); if (securityDefinition != null) { scopes.putAll(securityDefinition.getScopes()); } } } } return scopes; }
.OAUTH2SECURITY); if (securityDefinition != null) { scopes = securityDefinition.getScopes();
.OAUTH2SECURITY); if (securityDefinition != null) { scopes = securityDefinition.getScopes();
if (oAuth2Definition != null) { oAuth2Definition.getScopes().remove(name);
if (oAuth2Definition != null) { oAuth2Definition.getScopes().remove(name);
@Override public String updateScopesOnSwaggerDefinition(String resourceConfigJSON, Scope scope) { SwaggerParser swaggerParser = new SwaggerParser(); Swagger swagger = swaggerParser.parse(resourceConfigJSON); Map<String, SecuritySchemeDefinition> securitySchemeDefinitionMap = swagger.getSecurityDefinitions(); if (securitySchemeDefinitionMap != null && !securitySchemeDefinitionMap.isEmpty()) { OAuth2Definition oAuth2Definition = (OAuth2Definition) securitySchemeDefinitionMap.get(APIMgtConstants .OAUTH2SECURITY); if (oAuth2Definition != null) { // Removing Scope from Swagger SecurityDefinition Map<String, String> scopeMap = oAuth2Definition.getScopes(); if (scopeMap != null && scopeMap.containsKey(scope.getName())) { scopeMap.replace(scope.getName(), scope.getDescription()); } } } return Json.pretty(swagger); }
@Override public String updateScopesOnSwaggerDefinition(String resourceConfigJSON, Scope scope) { SwaggerParser swaggerParser = new SwaggerParser(); Swagger swagger = swaggerParser.parse(resourceConfigJSON); Map<String, SecuritySchemeDefinition> securitySchemeDefinitionMap = swagger.getSecurityDefinitions(); if (securitySchemeDefinitionMap != null && !securitySchemeDefinitionMap.isEmpty()) { OAuth2Definition oAuth2Definition = (OAuth2Definition) securitySchemeDefinitionMap.get(APIMgtConstants .OAUTH2SECURITY); if (oAuth2Definition != null) { // Removing Scope from Swagger SecurityDefinition Map<String, String> scopeMap = oAuth2Definition.getScopes(); if (scopeMap != null && scopeMap.containsKey(scope.getName())) { scopeMap.replace(scope.getName(), scope.getDescription()); } } } return Json.pretty(swagger); }
.OAUTH2SECURITY); Map<String, String> scopeMap = oAuth2Definition.getScopes(); if (scopeMap != null) { scopeMap.put(scope.getName(), scope.getDescription());
.OAUTH2SECURITY); Map<String, String> scopeMap = oAuth2Definition.getScopes(); if (scopeMap != null) { scopeMap.put(scope.getName(), scope.getDescription());
if (oauth2Scheme.getScopes() != null && !oauth2Scheme.getScopes().isEmpty()) { StringColumn.Builder nameColumnBuilder = StringColumn.builder(StringColumnId.of(labels.getLabel(NAME_COLUMN))) .putMetaData(TableComponent.WIDTH_RATIO, "3") .putMetaData(TableComponent.HEADER_COLUMN, "true"); for (Map.Entry<String, String> scope : oauth2Scheme.getScopes().entrySet()) { nameColumnBuilder.add(scope.getKey()); descriptionColumnBuilder.add(scope.getValue());
Map<String, String> oAuth2Scopes = oAuth2Definition.getScopes(); if (oAuth2Scopes != null) { oAuth2Scopes.forEach((k, v) -> scopes.addString(k, v));
Map<String, String> oAuth2Scopes = oAuth2Definition.getScopes(); if (oAuth2Scopes != null) { oAuth2Scopes.forEach((k, v) -> scopes.addString(k, v));
Map<String, String> oAuth2Scopes = oAuth2Definition.getScopes(); if (oAuth2Scopes != null) { oAuth2Scopes.forEach((k, v) -> scopes.addString(k, v));