Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

TT-4275 Update dev portal object #195

Merged
merged 3 commits into from
Feb 11, 2022
Merged

Conversation

sredxny
Copy link
Contributor

@sredxny sredxny commented Feb 11, 2022

update the dev portal object so when it calls update method the information is not lost

Description

As TIB didn't know about new dev-portal fields, then when it called an update for an user some information was lost because dashboard receives the key with empty value.

Related Issue

https://tyktech.atlassian.net/browse/TT-4275

Motivation and Context

Provide consistency with the data

How This Has Been Tested

  • Enabled MultiAPI Subscriptions in dev portal
  • Created 2 apis with authentication token as authentication method
  • Created one policy for each api
  • Exposed the api in the catalog using the policies created previously
  • Ran TIB as standalone app
  • Created a profile to be used to SSO dev portal, it looks like:
{
  "ID": "ldap-for-sso-dev-portal",
  "Name": "ldap-for-sso-dev-portal",
  "OrgID": "5e2091c4d4aefce60c04fb92",
  "ActionType": "GenerateOrLoginDeveloperProfile",
  "MatchedPolicyID": "",
  "Type": "passthrough",
  "ProviderName": "ADProvider",
  "ProviderConfig": {
    "FailureRedirect": "http://tyk-portal:3000/login",
    "LDAPAttributes": [],
    "LDAPPort": "389",
    "LDAPServer": "ldap.forumsys.com",
    "LDAPUserDN": "cn=*USERNAME*,dc=example,dc=com"
  },
  "IdentityHandlerConfig": {
    "DashboardCredential": "b72f2d7713b34cdb643f7fefcc1eb8c8"
  },
  "ReturnURL": "http://tyk-portal:3000/sso/",
}
  • Login to dev portal (it doesnt matter how, if with sso or user/password)
  • Created the key for both apis
  • Check the database, look in portal_developers collection your dev, then check keys, you will see your key and inside that 2 elements that basically are the relations
  • Now I request the nonce using:
curl --location --request POST 'tyk-dashboard:3010/auth/ldap-for-sso-dev-portal/ADProvider' \
--header 'Content-Type: application/x-www-form-urlencoded' \
--data-urlencode 'username=read-only-admin' \
--data-urlencode 'password=password'

Screenshots (if appropriate)

Types of changes

  • 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

  • Make sure you are requesting to pull a topic/feature/bugfix branch (right side). If pulling from your own
    fork, don't request your master!
  • Make sure you are making a pull request against the master branch (left side). Also, you should start
    your branch off our latest master.
  • My change requires a change to the documentation.
    • If you've changed APIs, describe what needs to be updated in the documentation.
    • If new config option added, ensure that it can be set via ENV variable
  • I have updated the documentation accordingly.
  • Modules and vendor dependencies have been updated; run go mod tidy && go mod vendor
  • When updating library version must provide reason/explanation for this update.
  • I have added tests to cover my changes.
  • All new and existing tests passed.
  • Check your code additions will not fail linting checks:
    • go fmt -s
    • go vet

Fields map[string]string `bson:"fields" json:"fields"`
Nonce string `bson:"nonce" json:"nonce"`
SSOKey string `bson:"sso_key" json:"sso_key"`
Id bson.ObjectId `bson:"_id,omitempty" json:"id"`
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@furkansenharputlu hi, I see this id to be bson.ObjectId, so am wondering if this will be an issue when dashboard use an SQL database.

Copy link

@gregdelhon gregdelhon left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@gregdelhon gregdelhon merged commit fb3fb08 into master Feb 11, 2022
@gregdelhon gregdelhon deleted the TT-4275-update-dev-portal-object branch February 11, 2022 15:59
sredxny added a commit that referenced this pull request Feb 11, 2022
* update the dev portal object so when it calls update method the information is not lost

* clea debug lines

* use bson.id as portaldev ID
@sredxny
Copy link
Contributor Author

sredxny commented Feb 11, 2022

applied to release-1.2 as well

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants