Skip to content

Commit

Permalink
[TT-11426/TT-13322] Add deprecation notice for external OAuth middlew…
Browse files Browse the repository at this point in the history
…are(#6657) (#6688)

#6657

### **User description**
<!-- Provide a general summary of your changes in the Title above -->

## Description

<!-- Describe your changes in detail -->

## Related Issue
Parent: https://tyktech.atlassian.net/browse/TT-11426 Subtask:
https://tyktech.atlassian.net/browse/TT-13322

## Motivation and Context

<!-- Why is this change required? What problem does it solve? -->

## How This Has Been Tested

<!-- Please describe in detail how you tested your changes --> <!--
Include details of your testing environment, and the tests --> <!-- you
ran to see how your change affects other areas of the code, etc. -->
<!-- This information is helpful for reviewers and QA. -->

## Screenshots (if appropriate)

## Types of changes

<!-- What types of changes does your code introduce? Put an `x` in all
the boxes that apply: -->

- [ ] Bug fix (non-breaking change which fixes an issue)
- [ ] New feature (non-breaking change which adds functionality)
- [ ] Breaking change (fix or feature that would cause existing
functionality to change)
- [ ] Refactoring or add test (improvements in base code or adds test
coverage to functionality)

## Checklist

<!-- Go over all the following points, and put an `x` in all the boxes
that apply -->
<!-- If there are no documentation updates required, mark the item as
checked. -->
<!-- Raise up any additional concerns not covered by the checklist. -->

- [ ] I ensured that the documentation is up to date
- [ ] I explained why this PR updates go.mod in detail with reasoning
why it's required
- [ ] I would like a code coverage CI quality gate exception and have
explained why


___

### **PR Type**
enhancement, documentation


___

### **Description**
- Added a deprecation notice for the external OAuth middleware in the
`EnabledForSpec` function.
- Warned users that support for this middleware will be deprecated
starting from version 5.7.0.
- Recommended using JSON Web Token (JWT) instead and provided a link to
the documentation for guidance.



___



### **Changes walkthrough** 📝
<table><thead><tr><th></th><th align="left">Relevant
files</th></tr></thead><tbody><tr><td><strong>Enhancement</strong></td><td><table>
<tr>
  <td>
    <details>
<summary><strong>mw_external_oauth.go</strong><dd><code>Add deprecation
warning for external OAuth middleware</code>&nbsp; &nbsp; &nbsp; &nbsp;
</dd></summary>
<hr>

gateway/mw_external_oauth.go

<li>Added a deprecation warning for the external OAuth middleware.<br>
<li> Suggested using JSON Web Token (JWT) as an alternative.<br> <li>
Provided a link to the relevant documentation for more information.<br>


</details>


  </td>
<td><a

href="https://github.com/TykTechnologies/tyk/pull/6657/files#diff-49758921227a3506a0c29936c58d02fbc8829d140acb5730de55f6621823a82c">+4/-0</a>&nbsp;
&nbsp; &nbsp; </td>

</tr>                    
</table></td></tr></tr></tbody></table>

___

> 💡 **PR-Agent usage**: Comment `/help "your question"` on any pull
request to receive relevant information

---------

<!-- Provide a general summary of your changes in the Title above -->

## Description

<!-- Describe your changes in detail -->

## Related Issue

<!-- This project only accepts pull requests related to open issues. -->
<!-- If suggesting a new feature or change, please discuss it in an
issue first. -->
<!-- If fixing a bug, there should be an issue describing it with steps
to reproduce. -->
<!-- OSS: Please link to the issue here. Tyk: please create/link the
JIRA ticket. -->

## Motivation and Context

<!-- Why is this change required? What problem does it solve? -->

## How This Has Been Tested

<!-- Please describe in detail how you tested your changes -->
<!-- Include details of your testing environment, and the tests -->
<!-- you ran to see how your change affects other areas of the code,
etc. -->
<!-- This information is helpful for reviewers and QA. -->

## Screenshots (if appropriate)

## Types of changes

<!-- What types of changes does your code introduce? Put an `x` in all
the boxes that apply: -->

- [ ] Bug fix (non-breaking change which fixes an issue)
- [ ] New feature (non-breaking change which adds functionality)
- [ ] Breaking change (fix or feature that would cause existing
functionality to change)
- [ ] Refactoring or add test (improvements in base code or adds test
coverage to functionality)

## Checklist

<!-- Go over all the following points, and put an `x` in all the boxes
that apply -->
<!-- If there are no documentation updates required, mark the item as
checked. -->
<!-- Raise up any additional concerns not covered by the checklist. -->

- [ ] I ensured that the documentation is up to date
- [ ] I explained why this PR updates go.mod in detail with reasoning
why it's required
- [ ] I would like a code coverage CI quality gate exception and have
explained why

Co-authored-by: Tit Petric <[email protected]>
  • Loading branch information
jeffy-mathew and titpetric authored Oct 31, 2024
1 parent da60cf6 commit 584b101
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 0 deletions.
3 changes: 3 additions & 0 deletions apidef/api_definitions.go
Original file line number Diff line number Diff line change
Expand Up @@ -1368,6 +1368,9 @@ var Template = template.New("").Funcs(map[string]interface{}{
},
})

// ExternalOAuth support will be deprecated starting from 5.7.0.
// To avoid any disruptions, we recommend that you use JSON Web Token (JWT) instead,
// as explained in https://tyk.io/docs/basic-config-and-security/security/authentication-authorization/ext-oauth-middleware/.
type ExternalOAuth struct {
Enabled bool `bson:"enabled" json:"enabled"`
Providers []Provider `bson:"providers" json:"providers"`
Expand Down
1 change: 1 addition & 0 deletions apidef/oas/schema/x-tyk-api-gateway.json
Original file line number Diff line number Diff line change
Expand Up @@ -1611,6 +1611,7 @@
},
"X-Tyk-ExternalOAuth": {
"type": "object",
"description": "Support for external OAuth Middleware will be deprecated starting from 5.7.0. To avoid any disruptions, we recommend that you use JSON Web Token (JWT) instead, as explained in https://tyk.io/docs/basic-config-and-security/security/authentication-authorization/ext-oauth-middleware/",
"properties": {
"enabled": {
"type": "boolean"
Expand Down
3 changes: 3 additions & 0 deletions apidef/oas/security.go
Original file line number Diff line number Diff line change
Expand Up @@ -582,6 +582,9 @@ func (c *IntrospectionCache) ExtractTo(cache *apidef.IntrospectionCache) {
}

// ExternalOAuth holds configuration for an external OAuth provider.
// ExternalOAuth support will be deprecated starting from 5.7.0.
// To avoid any disruptions, we recommend that you use JSON Web Token (JWT) instead,
// as explained in https://tyk.io/docs/basic-config-and-security/security/authentication-authorization/ext-oauth-middleware/.
type ExternalOAuth struct {
// Enabled activates external oauth functionality.
Enabled bool `bson:"enabled" json:"enabled"` // required
Expand Down
4 changes: 4 additions & 0 deletions gateway/mw_external_oauth.go
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,10 @@ func (k *ExternalOAuthMiddleware) Name() string {
}

func (k *ExternalOAuthMiddleware) EnabledForSpec() bool {
if k.Spec.ExternalOAuth.Enabled {
log.Warn("Support for external OAuth Middleware will be deprecated starting from 5.7.0. To avoid any disruptions, we recommend that you use JSON Web Token (JWT) instead, as explained in https://tyk.io/docs/basic-config-and-security/security/authentication-authorization/ext-oauth-middleware/")
}

return k.Spec.ExternalOAuth.Enabled
}

Expand Down

0 comments on commit 584b101

Please sign in to comment.