use of io.apicurio.datamodels.openapi.v2.models.Oas20SecurityScheme in project apicurio-data-models by Apicurio.
the class DeleteSecuritySchemeCommand_20 method doRestoreScheme.
/**
* @see io.apicurio.datamodels.cmd.commands.DeleteSecuritySchemeCommand#doRestoreScheme(io.apicurio.datamodels.core.models.Document, java.lang.Object)
*/
@Override
protected void doRestoreScheme(Document document, Object oldScheme) {
Oas20Document doc20 = (Oas20Document) document;
Oas20SecurityDefinitions definitions = doc20.securityDefinitions;
if (this.isNullOrUndefined(definitions) || this.isNullOrUndefined(oldScheme)) {
return;
}
Oas20SecurityScheme scheme = definitions.createSecurityScheme(this._schemeName);
Library.readNode(oldScheme, scheme);
definitions.addSecurityScheme(this._schemeName, scheme);
}
use of io.apicurio.datamodels.openapi.v2.models.Oas20SecurityScheme in project apicurio-data-models by Apicurio.
the class ChangeSecuritySchemeCommand_20 method nullScheme.
/**
* @see io.apicurio.datamodels.cmd.commands.ChangeSecuritySchemeCommand#nullScheme(io.apicurio.datamodels.core.models.common.SecurityScheme)
*/
@Override
protected void nullScheme(SecurityScheme scheme) {
super.nullScheme(scheme);
Oas20SecurityScheme scheme20 = (Oas20SecurityScheme) scheme;
scheme20.tokenUrl = null;
scheme20.authorizationUrl = null;
scheme20.flow = null;
scheme20.scopes = null;
}
use of io.apicurio.datamodels.openapi.v2.models.Oas20SecurityScheme in project apicurio-data-models by Apicurio.
the class Oas20Traverser method visitSecurityScheme.
/**
* @see io.apicurio.datamodels.core.visitors.IVisitor#visitSecurityScheme(io.apicurio.datamodels.core.models.common.SecurityScheme)
*/
@Override
public void visitSecurityScheme(SecurityScheme node) {
Oas20SecurityScheme node20 = (Oas20SecurityScheme) node;
node.accept(this.visitor);
this.traverseIfNotNull(node20.scopes);
this.traverseExtensions(node);
this.traverseValidationProblems(node);
}
use of io.apicurio.datamodels.openapi.v2.models.Oas20SecurityScheme in project apicurio-data-models by Apicurio.
the class Oas20DataModelWriter method writeSecurityScheme.
/**
* @see io.apicurio.datamodels.core.io.DataModelWriter#writeSecurityScheme(java.lang.Object, io.apicurio.datamodels.core.models.common.SecurityScheme)
*/
@Override
protected void writeSecurityScheme(Object json, SecurityScheme node) {
Oas20SecurityScheme node20 = (Oas20SecurityScheme) node;
JsonCompat.setPropertyString(json, Constants.PROP_FLOW, node20.flow);
JsonCompat.setPropertyString(json, Constants.PROP_AUTHORIZATION_URL, node20.authorizationUrl);
JsonCompat.setPropertyString(json, Constants.PROP_TOKEN_URL, node20.tokenUrl);
JsonCompat.setPropertyNull(json, Constants.PROP_SCOPES);
super.writeSecurityScheme(json, node);
}
use of io.apicurio.datamodels.openapi.v2.models.Oas20SecurityScheme in project syndesis by syndesisio.
the class OpenApiConnectorGeneratorTest method shouldNotProvideAuthenticationPropertiesWithMultipleSecurityDefinitionsMatching.
@Test
public void shouldNotProvideAuthenticationPropertiesWithMultipleSecurityDefinitionsMatching() {
final Oas20Document openApiDoc = new Oas20Document();
openApiDoc.securityDefinitions = openApiDoc.createSecurityDefinitions();
Oas20SecurityScheme scheme1 = openApiDoc.securityDefinitions.createSecurityScheme("one");
scheme1.in = "query";
scheme1.type = "apiKey";
Oas20SecurityScheme scheme2 = openApiDoc.securityDefinitions.createSecurityScheme("two");
scheme2.in = "header";
scheme2.type = "apiKey";
openApiDoc.securityDefinitions.addSecurityScheme("one", scheme1);
openApiDoc.securityDefinitions.addSecurityScheme("two", scheme2);
final String specification = Library.writeDocumentToJSONString(openApiDoc);
final ConnectorSettings connectorSettings = new ConnectorSettings.Builder().putConfiguredProperty("specification", specification).build();
final APISummary summary = generator.info(ApiConnectorTemplate.SWAGGER_TEMPLATE, connectorSettings);
assertThat(summary.getProperties().keySet()).containsOnly("authenticationType", "basePath", "host", "specification");
}
Aggregations