Java Code Examples for io.swagger.v3.oas.models.security.SecurityScheme#getIn()
The following examples show how to use
io.swagger.v3.oas.models.security.SecurityScheme#getIn() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: SecuritySchemeSerializer.java From api-layer with Eclipse Public License 2.0 | 6 votes |
@Override public void serialize(SecurityScheme value, JsonGenerator jGen, SerializerProvider serializers) throws IOException { ObjectMapper objectMapper = new ObjectMapper(); objectMapper.setSerializationInclusion(JsonInclude.Include.NON_NULL); String securitySchemeContent = objectMapper.writeValueAsString(value); ObjectNode jsonNode = objectMapper.readValue(securitySchemeContent, ObjectNode.class); SecurityScheme.Type securitySchemeType = value.getType(); if (securitySchemeType != null) { jsonNode.put("type", securitySchemeType.toString()); } SecurityScheme.In securitySchemeIn = value.getIn(); if (securitySchemeIn != null) { jsonNode.put("in", securitySchemeIn.toString()); } jGen.writeObject(jsonNode); }
Example 2
Source File: OpenApiSecuritySchemeValidations.java From openapi-generator with Apache License 2.0 | 5 votes |
/** * Apache and Nginx default to legacy CGI behavior in which header with underscore are ignored. Raise this for awareness to the user. * * @param securityScheme Security schemes are often used as header parameters (e.g. APIKEY). * @return <code>true</code> if the check succeeds (header does not have an underscore, e.g. 'api_key') */ private static ValidationRule.Result apacheNginxHeaderCheck(SecuritySchemeWrapper securitySchemeWrapper) { SecurityScheme securityScheme = securitySchemeWrapper.getSecurityScheme(); if (securityScheme == null || securityScheme.getIn() != SecurityScheme.In.HEADER) return ValidationRule.Pass.empty(); ValidationRule.Result result = ValidationRule.Pass.empty(); String key = securityScheme.getName(); if (StringUtils.contains(key, '_')) { result = new ValidationRule.Fail(); result.setDetails(String.format(Locale.ROOT, "%s contains an underscore.", key)); } return result; }
Example 3
Source File: SecurityRequirementsDiff.java From openapi-diff with Apache License 2.0 | 4 votes |
private Pair<SecurityScheme.Type, SecurityScheme.In> getPair(SecurityScheme securityScheme) { return new ImmutablePair<>(securityScheme.getType(), securityScheme.getIn()); }