Skip to content
GitLab
    • Explore Projects Groups Snippets
Projects Groups Snippets
  • /
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
    • Contribute to GitLab
  • Sign in / Register
  • O openapi-generator
  • Project information
    • Project information
    • Activity
    • Labels
    • Members
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Contributors
    • Graph
    • Compare
  • Issues 3,476
    • Issues 3,476
    • List
    • Boards
    • Service Desk
    • Milestones
  • Merge requests 402
    • Merge requests 402
  • CI/CD
    • CI/CD
    • Pipelines
    • Jobs
    • Schedules
  • Deployments
    • Deployments
    • Environments
    • Releases
  • Packages and registries
    • Packages and registries
    • Package Registry
    • Infrastructure Registry
  • Monitor
    • Monitor
    • Incidents
  • Analytics
    • Analytics
    • Value stream
    • CI/CD
    • Repository
  • Wiki
    • Wiki
  • Snippets
    • Snippets
  • Activity
  • Graph
  • Create a new issue
  • Jobs
  • Commits
  • Issue Boards
Collapse sidebar
  • OpenAPI Tools
  • openapi-generator
  • Merge requests
  • !7346

Adds cookie auth support to ApiKeyAuth in dart2 templates

  • Review changes

  • Download
  • Email patches
  • Plain diff
Merged Administrator requested to merge github/fork/tek08/tek08-dart2-cookie into master 4 years ago
  • Overview 0
  • Commits 2
  • Pipelines 0
  • Changes 3

Created by: tek08

Issue #7344

This modifies api_client.mustache and api_key_auth.mustache to allow an option of cookie for location of apiKey. To test, you can create a security schema such as:

securitySchemes:
  ExampleCookieAuth:
    type: apiKey
    in: cookie
    name: session

This should send a Cookie header up to server with semi-colon separated auth keys/values e.g.:

Cookie: session=12345; otherAuthKey=abcdef

PR checklist

  • Read the contribution guidelines.
  • Pull Request title clearly describes the work in the pull request and Pull Request description provides details about how to validate the work. Missing information here may result in delayed response from the community.
  • If contributing template-only or documentation-only changes which will change sample output, build the project beforehand.
  • Run the shell script ./bin/generate-samples.shto update all Petstore samples related to your fix. This is important, as CI jobs will verify all generator outputs of your HEAD commit as it would merge with master. These must match the expectations made by your contribution. You may regenerate an individual generator by passing the relevant config(s) as an argument to the script, for example ./bin/generate-samples.sh bin/configs/java*. For Windows users, please run the script in Git BASH.
  • File the PR against the correct branch: master
  • Copy the technical committee to review the pull request if your PR is targeting a particular programming language. (@ircecho @swipesight @jaumard @athornz @amondnet )
Compare
  • master (base)

and
  • latest version
    c66926f5
    2 commits, 2 years ago

3 files
+ 9
- 1

    Preferences

    File browser
    Compare changes
modules/openapi-ge‎nerator/…/…/…/dart2‎
au‎th‎
api_key_au‎th.mustache‎ +4 -0
api_clien‎t.mustache‎ +1 -1
samples/client/pet‎store/…/…/lib/auth‎
api_key_‎auth.dart‎ +4 -0
modules/openapi-generator/src/main/resources/dart2/auth/api_key_auth.mustache
+ 4
- 0
  • View file @ c66926f5

  • Edit in single-file editor

  • Open in Web IDE


@@ -24,6 +24,10 @@ class ApiKeyAuth implements Authentication {
queryParams.add(QueryParam(paramName, value));
} else if (location == 'header' && value != null) {
headerParams[paramName] = value;
} else if (location == 'cookie' && value != null) {
headerParams.update('Cookie', (String existingCookie) {
return "$existingCookie; $paramName=$value";
}, ifAbsent: () => '$paramName=$value');
}
}
}
modules/openapi-generator/src/main/resources/dart2/api_client.mustache
+ 1
- 1
  • View file @ c66926f5

  • Edit in single-file editor

  • Open in Web IDE


@@ -31,7 +31,7 @@ class ApiClient {
{{/isBasicBearer}}
{{/isBasic}}
{{#isApiKey}}
_authentications['{{name}}'] = ApiKeyAuth({{#isKeyInHeader}}"header"{{/isKeyInHeader}}{{^isKeyInHeader}}"query"{{/isKeyInHeader}}, "{{keyParamName}}");
_authentications['{{name}}'] = ApiKeyAuth({{#isKeyInCookie}}"cookie"{{/isKeyInCookie}}{{^isKeyInCookie}}{{#isKeyInHeader}}"header"{{/isKeyInHeader}}{{^isKeyInHeader}}"query"{{/isKeyInHeader}}{{/isKeyInCookie}}, "{{keyParamName}}");
{{/isApiKey}}
{{#isOAuth}}
_authentications['{{name}}'] = OAuth();
samples/client/petstore/dart2/petstore_client_lib/lib/auth/api_key_auth.dart
+ 4
- 0
  • View file @ c66926f5

  • Edit in single-file editor

  • Open in Web IDE


@@ -24,6 +24,10 @@ class ApiKeyAuth implements Authentication {
queryParams.add(QueryParam(paramName, value));
} else if (location == 'header' && value != null) {
headerParams[paramName] = value;
} else if (location == 'cookie' && value != null) {
headerParams.update('Cookie', (String existingCookie) {
return "$existingCookie; $paramName=$value";
}, ifAbsent: () => '$paramName=$value');
}
}
}
0 Assignees
None
Assign to
0 Reviewers
None
Request review from
Labels
3
Client: Kotlin Enhancement: Feature Feature: Enum
3
Client: Kotlin Enhancement: Feature Feature: Enum
    Assign labels
  • Manage project labels

Milestone
5.1.1
5.1.1 (expired)
None
Time tracking
No estimate or time spent
Lock merge request
Unlocked
0
0 participants
Reference: OpenAPITools/openapi-generator!9143
Source branch: github/fork/tek08/tek08-dart2-cookie

Menu

Explore Projects Groups Snippets