loopbackio / loopbackio/strong-soap

the WSSecurityCert option no work

Open
#617 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

bug
Dominant language
JavaScript
Stars
410
Forks
162
Avg merge
4h 36m
Merged PRs (30d)
7

Description

  • The options WSSecurityCertm, when past the param options the class not use it
  the prefix not change
  const cerft = new soap.WSSecurityCert(certpri, ca, 'kpseos123', {
     prefix: 'ds',
   });

Additional information

i checked the core class, the class never user that param

class WSSecurityCert extends Security {
  constructor(privatePEM, publicP12PEM, password) {
    super();
    this.publicP12PEM = publicP12PEM.toString().replace('-----BEGIN CERTIFICATE-----', '').replace('-----END CERTIFICATE-----', '').replace(/(\r\n|\n|\r)/gm, '');
    this.signer = new SignedXml();
    this.signer.signingKey = this.getSigningKey(privatePEM, password);
    this.x509Id = 'x509-' + generateId();
    var references = ['http://www.w3.org/2000/09/xmldsig#enveloped-signature', 'http://www.w3.org/2001/10/xml-exc-c14n#'];
    this.signer.addReference('//*[local-name(.)=\'Body\']', references);
    this.signer.addReference('//*[local-name(.)=\'Timestamp\']', references);
    var _this = this;
    this.signer.keyInfoProvider = {};
    this.signer.keyInfoProvider.getKeyInfo = function (key) {
      var x509Id = _this.x509Id;
      var xml = `<wsse:SecurityTokenReference>
    <wsse:Reference URI="${x509Id}" ValueType="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-x509-token-profile-1.0#X509v3"/>
    </wsse:SecurityTokenReference>`;
      return xml;
    };
  }
```

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start at the WSSecurityCert constructor and its keyInfoProvider, especially the generated SecurityTokenReference XML. Trace how constructor options are passed and determine what it means for the configured prefix to be honored; done means the WSSecurityCert option affects the generated security XML as intended.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript, node.js
Domain
api, backend, security
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.