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

Fix types on SAMLConfig to allow privateKey #497

Closed
wants to merge 1 commit into from

Conversation

nicksrandall
Copy link

Description

The docs say to use privateKey instead of privateCert but when I do that, I get a Typescript error. This should fix that issue.

Checklist:

  • Issue Addressed: [X]
  • Link to SAML spec: [ ]
  • Tests included? [ ]
  • Documentation updated? [ ]

The docs say to use `privateKey` instead of `privateCert` but when I do that, I get a Typescript error. This should fix that issue.
@cjbarth
Copy link
Collaborator

cjbarth commented Nov 4, 2020

If this is merged, then other things will break as the subsequent refactoring of privateCert to privateKey hasn't been done.

Having said that, there are two interfaces at play: SamlConfig and SAMLOptions. The SAMLOptions is the one that was refactored, not the SamlConfig interface version of privateCert. Maybe we missed something, but maybe not, as they are different uses.

@markstos markstos requested a review from gugu November 5, 2020 15:31
@nicksrandall
Copy link
Author

IMO, if users are not supposed to be using privateKey yet, then I think the error message in the console should be removed. If they should be using privateKey, then that property needs to be added to the public types.

@gugu
Copy link
Contributor

gugu commented Nov 5, 2020

I don't think anything will break, @deprecated instruction will only mark a field as deprecated in IDE, no additional effects

@cjbarth
Copy link
Collaborator

cjbarth commented Nov 5, 2020

As I look this cover over closer, I see there are places were the deprecation of privateCert is incomplete. I'll see if I can address that.

@midgleyc
Copy link
Contributor

midgleyc commented Dec 7, 2020

@cjbarth This affects SamlConfig even when SAMLOptions is the one changed.

  • SAML has a constructor wanting options: Partial<SAMLOptions>
  • Strategy has a constructor taking options: SamlConfig
  • Strategy's constructor calls this._saml = new saml.SAML(options);

This works type-wise because SamlConfig is a subset of SAMLOptions, but shows a warning because SamlConfig can't have a privateKey field while SAMLOptions prefers it to privateCert.

A nicer solution might be to have SAML's constructor take a SAMLOptions where the optional fields have ?s, but this PR as-is would fix the typing issue on TypeScript projects using this library.

@cjbarth
Copy link
Collaborator

cjbarth commented Dec 14, 2020

@midgleyc I agree with your assessment. I really think these two interfaces should be consolidated. I believe this is just an artifact of the quick conversion to TypeScript that was done. I'll approve this to get things moving, but would you be willing to submit a PR to consolidate these interfaces?

@midgleyc
Copy link
Contributor

@cjbarth Thanks, see #515

@cjbarth
Copy link
Collaborator

cjbarth commented Dec 15, 2020

@nicksrandall, does the recent PR that landed address your concerns here? If so, please close this, otherwise, let's keep the dialog going.

@cjbarth
Copy link
Collaborator

cjbarth commented Jan 10, 2021

Closing in favor of #515

@cjbarth cjbarth closed this Jan 10, 2021
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.

4 participants