Skip to content

Conversation

@BuknSS
Copy link

@BuknSS BuknSS commented Oct 30, 2024

I need to call Alipay's "fund expenditure interface", and I have to change the key signature method to the certificate signature method, which will make the current Alipay Provider unavailable, so I refer to the Alipay official SDK code, add some code, just add two certificate-related fields in the request content:

  • app_cert_sn
  • alipay_root_cert_sn

When options AppCertPath and RootCertPath are configured with the certificate file path, the certificate signing mode will be enabled

Alipay's certificate signature document:


Alipay now only provides open_id to new merchants, without user_id. In this case, the following code will cause an error.

identity.AddClaim(new Claim(ClaimTypes.NameIdentifier, mainElement.GetString("user_id")!, ClaimValueTypes.String, Options.ClaimsIssuer));

Alipay's openid document:

Alipay documents are in Chinese, so they need to be translated.


Screenshot of network packet capture:
TokenEndpoint
Calling TokenEndpoint

UserInformationEndpoint
Calling UserInformationEndpoint

Comment on lines +65 to +67
public string? AppCertPath { get; set; }

public string? RootCertPath { get; set; }
Copy link
Member

@martincostello martincostello Oct 30, 2024

Choose a reason for hiding this comment

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

Don't assume that certificates are on the file system - they could (should?) be stored in a secure location, such as the Windows Certificate Manager, or loaded from a remote source such as Azure Key Vault. Take a look at the Apple provider for examples on handling such scenarios.

This example might also help: configuring Sign in With Apple

@Loongle

This comment was marked as off-topic.

@BuknSS

This comment was marked as off-topic.

@Loongle

This comment was marked as off-topic.

@BuknSS

This comment was marked as off-topic.

@martincostello
Copy link
Member

Closing due to inactivity - if you'd like to continue with this PR, please address the unresolved review comments and open a new pull request.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

3 participants