npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

@mcp-abap-adt/auth-providers

v8.0.1

Published

Every IAuthProvider for SAP ABAP ADT: the credentials a process delegates to, and the token providers behind them

Readme

@mcp-abap-adt/auth-providers

Stand With Ukraine

Every implementation of IAuthProvider for SAP ABAP ADT: the credential a process delegates to, and the token providers behind it.

Token providers, the Basic/Certificate/SAML/Token credentials, passwordless SNC logon and SPNego (Kerberos) over HTTP are each an IAuthProvider the process takes as it is — whether it is handed over directly to a connection, or through @mcp-abap-adt/auth-broker for the stateful token API (getTokens()/refreshTokens()).

Migrating to 8.0.0 — static types first

8.0.0 checks at runtime only what the TypeScript types cannot say. Options and collaborators are trusted to match their types. What comes from outside the type system is checked as before: a thrown value, a server's answer, a JWT, a SAML document, a file, the environment, registry output, terminal input, a callback request, GSS token bytes, a field a contract types unknown. No refusal, kind, case or operation is new; every refusal still produced keeps its words, facts and kind; the dependencies are unchanged. What a consumer on 7.x must do:

  • Pass options and collaborators that type-check. A TypeScript consumer whose code compiles against 8.0.0 needs nothing else. A JavaScript consumer, or one that casts, no longer gets a configuration refusal for a value of the wrong type; what a constructor does with such a value is not stated.
  • Options are a typed copy. Each constructor and factory copies its options once, with a shallow spread, instead of reading their own data properties: a getter on the options runs once, at creation (7.x read it as absent). A later change to your object still changes nothing. See Error Handling.
  • These configuration refusals are no longer produced. The cases stay on interfaces-auth's allowlist, so an exhaustive switch over case still compiles:
    • basic-encoding-missing: clientSecretBasic without encoding.
    • unsupported-sso-flow: SsoProviderFactory.create switches exhaustively over its typed flow.
    • required-fields-missing for a field its type requires: renewal (every token provider, inBrowser, fromTerminal, toConsole, SsoProviderFactory.create); servicePrincipal and tokenSource (SpnegoAuthProvider); presentation, transport, protocol and endpoint (composeAuthorization); presentation (openInBrowser without browser); show (consumerPresentation); receive (consumerAnswer); provide (consumerHandoff); redirectUri (manualPasteStrategy, manualSamlResponseStrategy, externalCodeStrategy); assertionValidator (both SAML providers); replayStore (the shipped validators); an absent uaaUrl or clientId (ClientCredentialsProvider, AuthorizationCodeProvider); an SncLogonProvider myName that is not a string. An empty uaaUrl or clientId is still refused.
    • invalid-value for a value of the wrong type: a persistence without a callable report; refreshStatePersistence's write not a function or onWriteFailure not 'continue' / 'fail'; a part of an authorization strategy without its methods, a transport label or a protocol redirect off its union; a browser name where an IBrowser belongs; remoteHint or read not a function; show for consumerPresentation's onFailure not a function; a servicePrincipal or redirectUri that is not a string. A string that cannot be used is still refused.
    • snc-partner-name-missing for a partnerName that is not a string, validator-no-certificates for idpCertificates absent or not an array, idp-certificate-invalid for a certificate that is not a string. An empty or blank partnerName, an empty idpCertificates and a malformed certificate are still refused.
  • An answer typed void is ignored. A request target's header() / cookies(), every ILogger method and the renewal strategy's aborted() are typed void; 7.x adopted what they returned and contained a rejection. A throw from the call is still handled. A rejecting promise returned despite the void type now raises unhandledRejection in your process: return nothing, or handle your own promise.
  • A collaborator's answer is used as typed. It is still adopted as await adopts it (a thenable works), then used as its contract types it. A throw while it is read — a getter of the answer — is handled like a throw from the call. An answer of another shape is no longer refused for its shape (a renewal decision with an unknown next, say); what follows is not stated.

Migrating to 6.0.0 — the error contract

6.0.0 replaces how this package says what went wrong. Every refusal and every throw is now an error of one closed list of kinds, minted by @mcp-abap-adt/auth-errors from allowlisted facts — not a class to match with instanceof, not words to parse. And nothing is bounded by a timeout of the package's choosing any more: your AbortSignal is the bound. What a consumer on 5.x must now do:

  • Install the contract it is read with. @mcp-abap-adt/auth-errors (^2.2.0) to read errors; @mcp-abap-adt/interfaces-auth (^7.5.0) is what every provider here implements, and where the parts of an authorization strategy (IAuthorizationPresentation, IAnswerTransport, IAuthorizationProtocol, IBrowser) are declared. The consumers on the same contract are published: @mcp-abap-adt/connection 15.0.0, @mcp-abap-adt/auth-stores 5.0.1, @mcp-abap-adt/auth-broker 5.0.5 and @mcp-abap-adt/auth-broker-cli 3.1.1. An older connection does not read these providers' refusals: 11.x reads the old refusal, and 12.0.0 (published only under next) is built on interfaces-auth 6. Keep one copy of each: npm ls @mcp-abap-adt/interfaces-auth and npm ls @mcp-abap-adt/auth-errors should show one deduplicated version.

  • Every token provider requires renewal. How a renewal proceeds — whether to refresh, whether to log in, when to stop, what becomes of a refresh token that was sent — is now a strategy the consumer gives (renewal: IRenewalStrategy). There is no default: a token provider (and inBrowser, fromTerminal, toConsole, SsoProviderFactory.create) constructed without one, or with one whose next is not a function, throws configuration required-fields-missing with fields: ['renewal'] (until 8.0.0: see Migrating to 8.0.0). renewal: refreshThenLogin() takes the steps 5.x took — one refresh, then one login when there is no refresh token or the refresh failed; refreshOnly() never logs in. See Renewal strategy.

    import { ClientCredentialsProvider, refreshThenLogin } from '@mcp-abap-adt/auth-providers';
    
    const provider = new ClientCredentialsProvider({
      uaaUrl, clientId, clientSecret,
      renewal: refreshThenLogin(),
    });
  • onTokens is gone; pass persistence. The config field onTokens is replaced by persistence?: ITokenPersistence, which receives one report per change of the provider's credentials (see Persistence strategy). The 5.x behaviour of onTokens — called with every new token, best effort — is refreshStatePersistence(write, { onWriteFailure: 'continue' }):

    // 5.x
    onTokens: async (result) => save(result),
    // 6.0.0
    persistence: refreshStatePersistence(
      async ({ authorizationToken, refreshToken, expiresAt }) =>
        save({ authorizationToken, refreshToken, expiresAt }),
      { onWriteFailure: 'continue' },
    ),

    write's refreshToken is a string (a new one: write it), undefined (the result carried none: leave the stored one, as a 5.x onTokens result without a refresh token meant) or null — new — (the provider discarded the refresh token: clear the stored one, so it is never sent again after a restart). onWriteFailure is required, with no default: 'continue' logs a failed write and goes on, as onTokens failures did; 'fail' makes the call that caused the write fail with it. A persistence strategy of your own whose awaited report throws now fails that call (getTokens(), refreshTokens(), or the moment) — unknown, operation persisting-tokens — where 5.x only logged a failing onTokens; the credentials stay committed and the next getTokens() answers them. Without persistence nothing is persisted.

  • No refreshTokenDisposition. interfaces-auth 6.0.0 added it to ITokenResult; interfaces-auth 7 removed it again, with the type RefreshTokenDisposition, and no release of this package carries it. What getTokens() / refreshTokens() return carries the refresh token the provider holds, or refreshToken: undefined — nothing more. A store learns what became of the refresh token from the persistence reports.

  • What a renewal answers changed where it could not produce a usable credential — it now throws, and what follows (log in again, give up) is yours. With refreshThenLogin():

    • a renewal that obtains a token still bound to another certificate than the pinned one: getTokens() / refreshTokens() throw token-binding renewed-bound-elsewhere (5.x returned the token);
    • a held token remembered as bound elsewhere: getTokens() throws the remembered error (5.x returned the token); prepare() no longer clears what is remembered — it renews once more;
    • rejected() with a 401 whose renewal is still bound elsewhere: Oops renewed-bound-elsewhere (5.x answered Ok);
    • a remembered expired client certificate is refused again by the pin — an equal refusal, no longer the same object;
    • a result that carries no usable refresh token — a refresh answered without a new one, a login without one — leaves the refresh token held in place (5.x dropped it), so the next renewal can still refresh;
    • a 403 for a token a renewal has already replaced: Ok, since what is presented changed;
    • a refresh that failed before it was sent (discovery, a client-authentication strategy or a loader failed first) no longer discards the refresh token.
  • A new kind, renewal-declined — "the renewal strategy declined to renew the credential", facts.trigger — for a renewal strategy that stops before taking any step, with no other refusal that explains it (for instance refreshOnly() with an expired token and no refresh token). An exhaustive matchKind / unreachableKind must handle it.

  • invalid-value is a configuration case, "a configured value cannot be used: <fields>": an unparseable authorizationUrl (5.x required-fields-missing), a persistence without a callable report, refreshStatePersistence's onWriteFailure or write, a part of an authorization strategy that cannot be used (below). Since 8.0.0 a value of the wrong type is not refused: see Migrating to 8.0.0.

  • Catch with readFailure, never instanceof. Every throw of this package — a constructor's configuration fault, a factory's, a loader's, getTokens() / refreshTokens() — is an AuthProviderFailure (one exception, your own error: refreshStatePersistence's report(), below). Read what you caught with readFailure(thrown, operation), which answers an IAuthProviderError for anything (a failure of another installed copy of auth-errors included, a forged one rebuilt from its kind and facts); test with isAuthProviderFailure(value) when you need a yes/no. An instanceof answers false across two copies of the package and true for a forgery, so it is never the test.

    import { matchKind, readFailure } from '@mcp-abap-adt/auth-errors';
    
    try {
      await provider.getTokens({ signal });
    } catch (thrown) {
      const error = readFailure(thrown, 'token-request');
      const advice = matchKind(error, {
        configuration: (e) => `fix ${e.facts.fields.join(', ')}`,
        'interactive-login': (e) => (e.facts.outcome === 'aborted' ? 'cancelled' : e.reason),
        'request-failed': (e) => `${e.reason}${e.facts.oauthError ? ` [${e.facts.oauthError}]` : ''}`,
        // … every kind: a missing handler does not compile …
        unknown: (e) => e.reason,
      });
    }

    Switch on kind with one of auth-errors' two exhaustiveness patterns — matchKind(error, handlers), or a switch whose default calls unreachableKind(error) — so that a kind added by a later major stops your build instead of falling through at run time. A plain switch is not checked.

  • The classes are gone. TokenProviderError, ValidationError, RefreshError, SessionDataError, ServiceKeyError, BrowserAuthError, AssertionValidationError, CertificateMaterialError, ClientAuthenticationError, ClientAuthenticationResultError, BasicClientIdError and TokenEndpointError are no longer exported, and AssertionCheck is imported from @mcp-abap-adt/interfaces-auth. What each carried is a kind and its facts:

    | 5.x | 6.0.0 | |---|---| | ValidationError (missingFields) | configuration — facts.case, facts.fields (Configuration errors) | | BrowserAuthError | interactive-login — facts.outcome (aborted, port-in-use, identity-provider-refused, busy, disposed, no-terminal, …) | | TokenEndpointError (status, oauthError, code); the reduced AxiosError | request-failed — facts.operation, facts.problem, facts.status, facts.oauthError, facts.code; tls — facts.code | | AssertionValidationError (check) | saml-assertion — facts.rule, facts.check (Refusal messages) | | CertificateMaterialError (incomplete, expired) | client-certificate — facts.problem (incomplete, unusable, expired) | | ClientAuthenticationError, ClientAuthenticationResultError, BasicClientIdError | client-authentication — facts.problem (signing-key-unusable, result-unsendable, basic-client-id-colon) | | RefreshError | credential-refused refresh-token — with refreshThenLogin(), as before, a refused refresh falls back to one login inside the provider | | SessionDataError, ServiceKeyError | nothing: they had no producer | | error.code (TOKEN_PROVIDER_ERROR_CODES, ASSERTION_ERROR_CODES) | kind — the constants are gone from interfaces-auth 6.0.0 |

  • refusalWords(error, what) → classify(error, operation) (auth-errors), then .reason / .hint. what was free text; an operation is one of the closed list OPERATIONS of interfaces-auth ('loading-certificate', 'token-request', …). A caller that passed a what of its own and wants no operation's words passes 'unfamiliar-error', which answers "an authentication error of a kind this version does not know" and no hint — a TLS failure's NODE_EXTRA_CA_CERTS hint included; an operation of the list keeps its words and hints. See Relaying a refusal.

  • A refusal is frozen, and only a minted one is trusted. AuthOutcome's refusal is the IAuthProviderError itself (IAuthRefusal = IAuthProviderError): refusal.reason and refusal.hint read as before, and refusal.kind / refusal.facts say what happened. Do not copy or edit one: it is frozen, so a mutation throws in strict code, and a copy ({ ...refusal }, a structuredClone, a JSON round-trip) is no longer minted — wherever it is read again it is rebuilt from its kind and facts, its diagnostics dropped; a provider of yours answering an outcome that is not one is answered unknown. Build an error you need with auth-errors' authError builders.

  • The words changed; match on facts. Every reason and hint is rendered from the kind and its facts. A token request refused reads the passcode exchange failed (HTTP 401) instead of Passcode exchange failed (401); an unfamiliar thrown value loading the certificate failed (unknown error, ENOENT) instead of naming a class or your what; a SAML refusal names its rule and no value of the document; the SNC library's path is a diagnostic, not a word. Code that matched words must match kind and facts instead.

  • No timeoutMs anywhere. DEFAULT_LOGIN_TIMEOUT_MS, every strategy's timeoutMs, the factories' { timeoutMs } and the 30 s (browser) and 300 s (passcode) defaults are removed, and so are the client credentials request's 30 s timeout and the SNC registry query's 5 s. A consumer passing timeoutMs must pass signal: AbortSignal.timeout(ms) instead — to the strategy, or to inBrowser / fromTerminal as { signal }; one passing nothing now waits until it aborts — a login until its result or the identity provider's refusal, a request until the server or the OS ends it. See Cancelling a login.

  • A browser that does not open is no longer an error. A browser that throws or rejects (yours, or a shipped one) gets one log line in fixed words and the authorization URL as a prompt on stderr, and the login keeps waiting: the callback still listens, so the URL shown — the only way to finish where no browser can be opened (SSH, a host without a desktop) — is live. The browser-launch-failed outcome is gone, and a launch failure never ends the login; code that matched it must stop. Bound the login with a signal (AbortSignal.timeout(ms)), or it ends on its result, the identity provider's refusal or your abort.

  • A login is bound to its attempt (login CSRF). Every URL AuthorizationCodeProvider and OidcBrowserProvider build carries state (and, for UAA, a PKCE challenge, S256); a configured authorizationUrl without state gets the provider's, which the identity provider must echo. The shipped protocols accept a redirect — a code or an ?error= — only with that state; a consumer's own strategy that receives the redirect itself must check state itself. The shipped listeners bind loopback only, and answer only Host: localhost / 127.0.0.1 / [::1] with their port, from a loopback peer: a browser on another machine reaches them through an SSH tunnel, or through a transport of your own. The paste page's /submit needs the form's token. See Login CSRF: state, PKCE and where the callback listens, and Interactive login: strategies by composition below for what changed in the strategies.

  • Your strategies end on the request's signal. Every AuthorizationRequest carries signal. externalCodeStrategy's provide is (authorizationUrl, signal), and a manual strategy's read(prompt, signal) must settle when its signal aborts: one that ignores it now blocks that strategy's authorize — and the next login, which waits for the aborted one to settle — where 5.x settled through a race.

  • The server's text is gone, also from logs. A token endpoint's error_description and error_uri are read by nothing, in errors and in log lines, by default and with authDebug; only a registered OAuth error survives, as facts.oauthError (5.4.2's err.response.data.error). A consumer that read error_description from a log or an error no longer finds it. authDebug: true on a token provider adds, to its one line for a failed request, the secrets the request sent — each prepared: at most its first 4 and last 4 characters plus its length, the length only below 16 characters — and never the server's text. See Debug Logging.

  • A subclass of BaseTokenProvider. performLogin() is now performLogin(attempt) — hand attempt.signal to whatever the login waits on — and performRefresh() is performRefresh(refreshToken, signal, dispatched): send the refresh token you are given — reading this.refreshToken instead may send one the renewal strategy discarded, a spent one — and call dispatched() right before the request leaves (pass this.refreshSiteOptions(dispatched) to a shipped token site, which does it). A refresh that never calls dispatched() counts as never sent: an abort then never applies the decision's ifCut, and its refresh token stays held although the server may have spent it. A subclass's constructor passes renewal through its config like any other token provider. A provider of your own extends AuthProviderBase and implements onPrepare(), onEstablish(logon), onAuthorize(request) and onRejected(rejection); the base owns the four moments and runs each inside auth-errors' guard. See Writing a provider of your own.

  • A cut refresh: the strategy decided before it was sent. A refresh whose callers all aborted after it was sent runs on; what becomes of the refresh token it sent is the ifCut of the decision that started it. refreshThenLogin() and refreshOnly() say 'discard' — that refresh token is never sent again by the provider, so with refreshThenLogin() the next renewal may log in, as in 5.x; a strategy of your own may say 'keep'. A refresh aborted before it was sent touches no refresh token. See Cancelling a login.

  • A declined SAML login is refused declined. The signed-Response validator reads Status right after the signature checks, before counting the Assertion, so a login the identity provider declined — which carries no Assertion — is refused declined with its status code, where 5.x refused it as carrying no direct-child Assertion (no-direct-assertion).

  • Device polling follows RFC 8628. slow_down adds 5 s to every later poll, cumulatively; an interval that is not a finite, non-negative number is 5 s; authorization_pending / slow_down keep the poll going only with status 400.

What is no longer available anywhere (each decided with the change; the facts that remain are listed with it):

  • the token endpoint's error_description and error_uri (the registered error stays, as facts.oauthError);
  • a cause on any error, and the identity of a thrown value: a strategy's, loader's or presenter's own error reaches you classified, never as itself, and no AxiosError escapes;
  • a rejected configuration value — the callback port, the SNC qop, a clockSkewMs (the field name stays, and for qop the allowed values);
  • each configuration error's own sentence, replaced by its case's fixed words;
  • the text of an exception inside a SAML refusal (xml-crypto's, the XML parser's);
  • a document value that fails admission (a control, bidirectional or line-separator character, or the wrong shape) — dropped, not escaped;
  • values moved from the words to diagnostics — the SNC library path, each SNC candidate's path, the two URIs of an ACS or redirect mismatch: shown by renderDiagnostics(error), not by reason / hint;
  • your own what in a relayed refusal (an operation of the closed list instead);
  • the class label in "<what> failed (<Class>)", and which of the abort moments or empty inputs a login met;
  • error.code, missingFields, check as a property, CertificateMaterialError.incomplete / .expired / .words, TokenEndpointError.status / .oauthError / .code — each now a fact;
  • the diagnostics of an error that crosses another installed copy of auth-errors, or that was not minted (its kind and facts stay);
  • every built-in login timeout and its message ("Authentication timeout after N seconds", "did not arrive in time");
  • the authorization URL in a log line: it is prompted on stderr only, and the logger gets "the authorization URL was shown";
  • the log lines of 5.x's 'auto' browser, and the DISPLAY=:0 5.x set for 'system' and a named browser: a browser has no logger, and the package writes nothing into process.env;
  • the open and express dependencies.

Interactive login: strategies by composition

An authorization strategy is now composed of three parts, each a contract of @mcp-abap-adt/interfaces-auth 7.4.0 (IBrowser is 7.5.0's): a presentation (how the URL reaches the user), a transport (how the user's answer comes back) and a protocol (what an answer is and how it is checked). The named strategies are compositions of the shipped parts, under the same names (see Composing a strategy from parts). What a consumer on 5.x must now do:

  • browserCallbackStrategy / oidcCallbackStrategy / samlCallbackStrategy with port, signal, remoteHint: no change. browser is an IBrowser, no longer a string — no browser is named by a string anywhere — and you pick it for the platform you run on:

    | 5.x | Linux | macOS | Windows | |---|---|---|---| | 'system', 'auto' | linuxDefaultBrowser() | macDefaultBrowser() | windowsDefaultBrowser() | | 'chrome' | linuxBrowser('google-chrome') | macBrowser('Google Chrome') | windowsBrowser('chrome') | | 'edge' | linuxBrowser('microsoft-edge') | macBrowser('Microsoft Edge') | windowsBrowser('msedge') | | 'firefox' | linuxBrowser('firefox') | macBrowser('Firefox') | windowsBrowser('firefox') | | any other name ('msedge' included) — 5.x opened the system default browser | linuxDefaultBrowser() | macDefaultBrowser() | windowsDefaultBrowser() | | 'none', 'headless', absent | no browser | no browser | no browser |

    // 5.x: browserCallbackStrategy({ browser: 'system' })
    browserCallbackStrategy({ browser: linuxDefaultBrowser() })

    There is no platform check: each factory runs exactly its program, and on another OS it does whatever a program of that name does there — see The six shipped browsers. Pick the one for your platform. A consumer whose configuration holds a browser name maps it itself.

  • No list of candidates. 5.x handed a named browser to the open package, which on Linux took the first of google-chrome, google-chrome-stable, chromium, chromium-browser (for 'chrome') or microsoft-edge, microsoft-edge-dev (for 'edge') that was installed, and firefox for 'firefox'; only when open could not be loaded did a shell fallback try its own list. Now pass the executable that is installed — linuxBrowser('google-chrome-stable'), linuxBrowser('chromium'), linuxBrowser('/usr/bin/firefox-esr') — a name on PATH or an absolute path, as given.

  • 'auto' and 'system' are one: the platform's default browser. The log lines 5.x's 'auto' wrote while it tried launchers are gone (an IBrowser has no logger); a browser that fails shows only as the composer's fixed-words line Failed to present the authorization URL: … and the URL prompted on stderr.

  • No DISPLAY=:0. 5.x set DISPLAY=:0 on Linux, for 'system' and a named browser, when neither DISPLAY nor WAYLAND_DISPLAY was set. The package now writes nothing into process.env: without a display the launcher does what it does there (xdg-open fails, or starts a console browser it finds); a launch that fails has the URL shown once on stderr while the login waits. A display of your choice — or a remote Chrome, a console browser, WSL, an ssh-forwarded X — is a browser of your own (A browser of your own).

  • The open package is gone (and express): every launch is the package's own, a program started with an argument array, never a shell. A shipped browser binary (linuxBrowser) resolves as soon as it has started; a hand-off launcher (xdg-open, open, rundll32, PowerShell's Start-Process) when it exits 0.

  • openUrl is gone. One hook per decision: a callback that only opened the URL becomes an IBrowser, passed as browser; one that needed the redirect URI, or showed the URL in its own UI, becomes consumerPresentation({ show }), composed with composeAuthorization (Where the URL is shown).

    // 5.x: browserCallbackStrategy({ browser: 'system', openUrl: (url) => myOpen(url) })
    browserCallbackStrategy({ browser: { open: (url) => myOpen(url) } })

    In TypeScript openUrl no longer compiles. From plain JavaScript it is an unknown key, ignored without a word — so a 5.x JavaScript consumer that used openUrl to keep the URL (and the state it carries) off stderr now gets them on stderr, unless it passes its own IBrowser or presentation.

  • callbackServer is gone. A receiver of your own is an IAnswerTransport, composed: composeAuthorization({ presentation, transport: myTransport, protocol: oauthCode(), endpoint: '/callback' }). The transport hands each answer to the protocol's judge and never returns a payload: the composer takes only the payload the protocol accepted (A transport of your own). The BrowserCallbackStrategy class, BrowserCallbackStrategyOptions, withBrowserCallbackServer, withOidcCallbackServer and withSamlCallbackServer are removed — use composeAuthorization and the parts. CallbackServerFactory, ICallbackServerOptions and ICallbackServerHandle stay in interfaces-auth 7.4.0, deprecated and implemented by nothing.

  • A listener on another address is your own transport. The shipped listeners bind loopback only and advertise only what they bind. A listener on a network address, a hostname, a wildcard, behind a proxy or a translated port is an IAnswerTransport of yours, which builds its redirect from its own origin and the endpoint path — or keep the loopback listener and tunnel (ssh -L <port>:localhost:<port> <this machine>; see The SSH tunnel). (The host and allowedHosts options of the 6.0.0 prereleases never shipped.)

  • The terminal and consumer-code strategies need redirectUri. manualPasteStrategy(), manualSamlResponseStrategy() and externalCodeStrategy({ provide }) without redirectUri throw configuration required-fields-missing naming redirectUri (until 8.0.0, where the type requires it): pass the redirect registered with the identity provider (the ACS for SAML). Their http://localhost:61001/callback default is gone — it reached whatever held port 61001. manualPasscodeStrategy's redirectUri is gone (it was unused). staticCodeStrategy is unchanged.

  • externalCodeStrategy takes OAuth codes only. A SAML response or a passcode handed over by your code composes consumerHandoff with samlResponse() or passcode():

    const { presentation, transport } = consumerHandoff({
      redirectUri: acsUrl,
      provide: (url, signal) => ourSsoProxy.login(url, signal),
    });
    const strategy = composeAuthorization({
      presentation, transport, protocol: samlResponse(), endpoint: '/callback',
    });
  • The paste page's /submit is a POST (urlencoded, form_token and input, up to 5 MB), and every listener serves the paste page for its protocol — OIDC and SAML too, which had none. A page of yours that GETs /submit must POST.

  • Overlap is busy. A second authorize on one strategy while the first runs is interactive-login busy, for every composition — two terminal readers on one stdin are never right.

  • Every redirect callback is closed until the URL exists, the SAML one included; there is no gate to opt out of.

  • The authorization URL is prompted on stderr only. 5.x wrote the prompt to the logger's info when there was one. The URL carries state, and a configured one may carry anything, so it reaches no log line: the logger gets "the authorization URL was shown". Where the callback waits and the SSH hint still go to the logger (stderr without one). A consumer whose stderr is collected into its logs — an MCP server, say — shows the URL in its own UI with consumerPresentation.

  • A configured authorizationUrl without state gets one. The provider appends its minted state to it, so the identity provider must echo it (RFC 6749 §4.1.2); a URL that already carries one state keeps it. No redirect is accepted without this attempt's state.

  • A strategy of your own written from scratch (IAuthorizationStrategy) is unaffected: IAuthorizationStrategy and AuthorizationRequest did not change.

Migrating to 5.0.0 — a migration, not an update

History: the code and the error classes shown in this section are for that old version (5.0.0) and do not compile on 6.0.0. For 6.0.0, see Migrating to 6.0.0 — the error contract.

This section and the migrations after it describe earlier majors: their code shows the API of the version they migrate to, and the version they migrate from. Coming from one of them, apply them in order and then Migrating to 6.0.0 — above all for browser, now an IBrowser rather than a name, and for the manual and consumer-code strategies, which now require redirectUri.

History: what 5.0.0 changed. Where 6.0.0 changed it again — onTokens (now persistence), the timeoutMs of the manual strategies, BrowserAuthError, the connection version — Migrating to 6.0.0 is what holds.

5.0.0 is not an incremental release. Every provider here now implements IAuthProvider (@mcp-abap-adt/interfaces-auth 3.0.0) and can be handed to the process with no wrapper and no check of what it is — which is what a consumer migrates to, building its providers from this package and handing them to a @mcp-abap-adt/connection 10.0.0 process, rather than updating in place; 9.x speaks the old, narrower IAuthProvider.

  • Credentials come from here, not from @mcp-abap-adt/connection. BasicAuthProvider, CertificateAuthProvider, SamlAuthProvider, TokenAuthProvider and FileCertificateMaterialLoader moved into this package (src/credentials/); connection 10.0.0 removes its own copies. Import them from @mcp-abap-adt/auth-providers instead.
  • A token provider is handed to the process as it is. BaseTokenProvider implements IRefreshableTokenProvider, IAuthProvider, so every token provider — AuthorizationCodeProvider, ClientCredentialsProvider, OidcBrowserProvider, OidcDeviceFlowProvider, OidcPasswordProvider, OidcTokenExchangeProvider, Saml2BearerProvider, Saml2PureProvider, UaaPasscodeProvider — is an IAuthProvider, with no TokenAuthProvider wrapper around it. The broker's token API (getTokens() / refreshTokens()) is unchanged.
  • A store that persisted after getTokens() passes onTokens instead. Every token provider's config takes an optional onTokens?: (result: ITokenResult) => Promise<void>, called after every new token — a login or a refresh, never a cache hit — and awaited before the provider answers. It is best effort: a failing onTokens is logged (in fixed words only, since it holds the tokens) and does not fail the authentication.
  • Nothing is defaulted any more. A provider that used to build its own strategy, SAML validator, replay store or device-code output now takes it explicitly in its constructor — or the consumer calls the named factory: AuthorizationCodeProvider.inBrowser, OidcBrowserProvider.inBrowser, Saml2PureProvider.inBrowser, Saml2BearerProvider.inBrowser, UaaPasscodeProvider.fromTerminal, OidcDeviceFlowProvider.toConsole, CertificateAuthProvider.fromFiles, SncLogonProvider.forSecureLoginClient. Omitting authorization (or, for the SAML providers, assertionValidator) no longer compiles.
  • SAML trust configuration moved. idpCertificates, clockSkewMs and assertionReplayStore are no longer fields of Saml2BearerProviderConfig / Saml2PureProviderConfig; both now take assertionValidator: IAssertionValidator directly (still required, together with idpEntityId for a shipped validator). Build one yourself with createSignedResponseValidator / createSignedAssertionValidator, or call Saml2PureProvider.inBrowser(config, trust) / Saml2BearerProvider.inBrowser(config, trust) with a SamlTrust ({ idpCertificates, clockSkewMs?, replayStore? }) — the recipe builds the shipped validator and defaults replayStore to defaultReplayStore.
  • ShippedValidatorOptions.replayStore is required. A direct call to createSignedResponseValidator / createSignedAssertionValidator must now pass one — defaultReplayStore, or your own.
  • Manual strategies take timeoutMs and can be disposed. manualPasteStrategy, manualSamlResponseStrategy and manualPasscodeStrategy accept timeoutMs?: number; on expiry, or when dispose() is called, the pending read is abandoned with a BrowserAuthError and the terminal readline it opened is closed — dispose() ends every concurrent authorize(), and resolves once all have settled. read is now (prompt: string, signal: AbortSignal) => Promise<string> — the signal aborts on timeout or dispose, and a custom read that ignores it still loses the race.
  • Needs @mcp-abap-adt/connection 10.0.0.

Passwordless RFC logon (SNC)

SncLogonProvider logs an on-premise system on over RfcTransport with no password, through an installed SNC product — typically the SAP Secure Login Client, holding a certificate from SAP Secure Login Service or Kerberos. Measured 2026-09-29 against an on-premise system (Windows, Secure Login Client 3.0.3): the SNC logon, discovery, reads and LOCK/UNLOCK all succeeded over RfcTransport, each RFC conversation its own SNC logon at roughly 1–1.5 s. See docs/passwordless-sso.md for the HTTP alternatives, which remain undecided.

Prerequisites: the SNC product is installed and can log on to the profile used for SAP applications (it need not be running beforehand — see the probe rule below); the ABAP system accepts SNC for RFC and maps the certificate's SNC name to a user; and, for the RfcTransport wire itself, the machine has the SAP NW RFC SDK and @mcp-abap-adt/sap-rfc-lite installed. This package itself depends on neither — it produces logon parameters and loads nothing.

The usual choice:

import { SncLogonProvider } from '@mcp-abap-adt/auth-providers';

const provider = SncLogonProvider.forSecureLoginClient({
  partnerName: 'p:CN=<system SNC name>', // the ABAP system's SNC name
});

forSecureLoginClient assembles nodeSncSystem() (the machine seam), DefaultSncLibraryLocator(system, sncLib) and [SecureLoginClientProbe(system)] — "this machine, library discovery, the Secure Login Client probe". qop defaults to '9' (maximum, one of '1' | '2' | '3' | '8' | '9'), and myName is sent only when set. An empty or blank partnerName or another qop is thrown by the constructor as an AuthProviderFailure of kind configuration (snc-partner-name-missing, snc-qop-invalid — see the configuration errors table); the rejected qop value is never echoed.

No timeout of its own. prepare() may wait on the machine: on Windows the locator and the Secure Login Client probe read the registry through reg.exe (by its absolute path under %SystemRoot%\System32, no shell). Since 6.0.0 that query has no built-in timeout — it runs until reg.exe answers, or until the provider's signal aborts, which kills the child. Pass signal (in the config, or to forSecureLoginClient) or attach(signal) for each party sharing the provider; prepare() then ends Oops aborted (interactive-login) once every attached party has aborted. With no signal it waits for reg.exe; bounding it is the consumer's decision (AbortSignal.timeout(ms)). A locator or probe of your own receives the same signal as locate(signal) / appliesTo(path, signal). The abort is tested with a real child process on a POSIX system, and measured on a Windows host (2026-10-07, Windows 11 x64): the library found through the real reg.exe (HKLM\Software\SAP\SecureLogin, InstallPath64), and an abort answering aborted with the reg.exe child ended and none left running. Localised reg.exe output is not measured.

The explicit assembly, for a different SNC product, or a locator/probe of your own (no implicit defaults — a constructor takes every collaborator):

import {
  SncLogonProvider,
  DefaultSncLibraryLocator,
  SecureLoginClientProbe,
  nodeSncSystem,
} from '@mcp-abap-adt/auth-providers';

const system = nodeSncSystem();
const provider = new SncLogonProvider({
  partnerName: 'p:CN=<system SNC name>',
  locator: new DefaultSncLibraryLocator(system /*, sncLib */),
  probes: [new SecureLoginClientProbe(system)], // [] to name no product
});

Discovery order and skip rule. With no explicit sncLib, DefaultSncLibraryLocator tries, in order: the environment variable SNC_LIB_64 (on a 64-bit process), SNC_LIB, the Windows registry HKLM\Software\SAP\SecureLogin\InstallPath64 (InstallPath32 on a 32-bit process) plus lib\sapcrypto.dll, then the macOS bundle /Applications/Secure Login Client.app/Contents/MacOS/lib/libsapcrypto.dylib. An unusable candidate — missing, not a recognised library, or built for the wrong architecture — is skipped, its reason kept, rather than failing the whole search; empty or whitespace environment variables count as unset, and the registry value is trimmed before it becomes a path. Nothing usable → prepare() is Oops, kind snc, variant library-not-found, listing every candidate tried by its source and its reason, e.g. "no usable SNC library was found: SNC_LIB (wrong architecture); registry (missing)" — the source is one of SNC_LIB_64, SNC_LIB, registry, macOS bundle, and the reason one of missing, not a library, wrong architecture. Since 6.0.0 the paths are not in the words (they are local values, kept apart so a logger can drop them): error.facts.candidates[i] holds each source, reason and — for a wrong architecture — the architectures the file was built for, facts.processArch this process's, and error.diagnostics.candidatePaths[i] the path tried, index for index (null for a path the admission check refused, e.g. one holding a control character). renderDiagnostics(error) prints them as candidates: SNC_LIB "C:\\…\\sapcrypto.dll" (wrong architecture); registry "C:\\…\\sapcrypto.dll" (missing). No error message is ever part of it, and it needs no logger. An explicit sncLib is the only candidate: unusable, and the Oops names that one — "no usable SNC library was found: sncLib (missing)", the path in diagnostics — with no fallback to automatic discovery. With no candidate at all: "no usable SNC library was found: no candidate (SNC_LIB_64 and SNC_LIB are unset and no Secure Login Client installation was found)". A locator of your own that throws gets "no usable SNC library was found" alone: the candidate facts and paths are read only from DefaultSncLibraryLocator's own failure. The hint is always "set sncLib to the SNC (GSS) library of your SNC product". Architecture comes from the file header — PE Machine; Mach-O thin and universal (FAT_MAGIC / FAT_MAGIC_64); ELF e_machine — because the trap this guards against is measured, not theoretical: the Secure Login Client installer sets the machine-wide SNC_LIB to its x86 library, and a 64-bit Node process needs the x64 one the registry points at.

The probe rule — the product is named, not checked. A probe (ISncProductProbe { product; appliesTo(libraryPath) }) only says which product is behind the library, so that rejected() can say what to do. SecureLoginClientProbe applies to a library inside the Secure Login Client's own installation (the registry's install paths on Windows, matched case-insensitively; the app bundle on macOS); any other SNC library (gsskrb5.dll, another vendor's) has no product named. prepare() only resolves the library and notes which probe applies — nothing about the product is checked before logon, not that it runs, not that a profile is logged on. prepare() is therefore Ok with the client not running. Measured 2026-09-29 (Windows, Secure Login Client 3.0.3): with the client exited, the RFC open through its sapcrypto.dll started the client, which logged on — silently through the identity provider's SSO, or through its logon window. A "not running" refusal would have stopped logons that succeed. What follows for a consumer: an RFC open can wait on the client's logon window until the user answers it. Only the shipped SecureLoginClientProbe (recognised by class) yields the Secure Login Client hint; a probe of your own names its product in the log, never in a refusal.

The two explained failures, from rejected() — the RFC SDK reports both as a generic communication error, so the cause is found by searching the GSS error text (never returned; only fixed wording and an allowlisted key go out):

  • A2200019 — kind snc, variant no-credential; reason "the SNC library has no credential to present (A2200019)"; hint "log on in the Secure Login Client, to the profile used for SAP applications" when the Secure Login Client probe applied, otherwise "make sure the SNC product behind the SNC library is logged on" (since 6.0.0 the library's path is error.diagnostics.library, not a word). Measured 2026-09-29: with the client logged out, closing its logon window failed the RFC open with GSS-API(min): A2200019:Operation aborted by user or application, and rejected() answered with this reason.
  • SNCERR_INIT (or "gssapi library invalid/missing") — variant library-init-failed; reason "the RFC SDK could not initialise the SNC library (<archs>) as its SNC library (SNCERR_INIT)", the path in error.diagnostics.library, no hint — usually the architecture mismatch above, if a mismatched library somehow reached this point.
  • RFC_LOGON_FAILURE, or a rejection with neither a status nor an RFC key — variant logon-refused; reason "SNC logon refused", plus the key in parentheses (and as facts.rfcKey) when there is one — never the underlying message or object.
  • any other status or allowlisted RFC key (RFC_CLOSED, RFC_COMMUNICATION_FAILURE, …) — the neutral system-refused / rfc-failure of rule 5, not an snc refusal. Measured 2026-10-07 (Windows 11, Secure Login Client, Kerberos profile): a wrong partner name failed the RFC open with RFC_CLOSED and no GSS code the provider explains, and so did, once, a logon with the client stopped and no credential to present; rejected() answered system-refused / rfc-failure both times.

The GSS codes are found by plain substring search, never a regular expression over the SDK's text. establish() before prepare() is not-prepared ("the SNC provider is not prepared" — "connect() prepares it first"); a locator that answers no path is "no usable SNC library was found: the locator returned no path"; anything else escaping a moment is unknown, "the SNC provider failed while <moment> (unknown error)". A product probe that throws is logged ("an SNC product probe failed: the probe failed (unknown error)") and names nothing; "SNC library not found: <reason>" is logged with the paths only as the line's diagnostics field.

SPNego (Kerberos) over HTTP

SpnegoAuthProvider sends Authorization: Negotiate <token> on every request, the token made afresh by a source the consumer composes. It is for HTTP: an ADT call to an on-premise system that has SPNego enabled (see docs/passwordless-sso.md). Over RFC the system refuses a logon with no user, so establish() writes nothing and answers Ok (rule 3) — hand this provider to a connection that speaks HTTP.

import { SpnegoAuthProvider } from '@mcp-abap-adt/auth-providers';
import { gssapiTokenSource } from '@mcp-abap-adt/auth-spnego-gssapi';

const provider = new SpnegoAuthProvider({
  servicePrincipal: '[email protected]', // service@host, the GSS host-based name
  tokenSource: gssapiTokenSource({ mechanism: 'spnego' }),
});

This package has no native code, no install script and no dependency on @mcp-abap-adt/auth-spnego-gssapi: the consumer composes the two, and may give a source of its own instead (INegotiateTokenSource of @mcp-abap-adt/interfaces-auth 8). No factory assembles the provider with the system source, and tokenSource has no default (rule 7).

| Option | | |---|---| | servicePrincipal | required: the GSS host-based name service@host, nothing else — exactly one @, the service an ASCII letter then letters, digits or -, the host ASCII labels joined by single dots. HTTP/host@REALM (the Kerberos form), whitespace and non-ASCII are configuration invalid-value naming servicePrincipal, never the value, thrown at construction. How the source turns it into its library's form is the source's | | tokenSource | required: an INegotiateTokenSource, whose token(servicePrincipal, { signal }) is called only inside a moment | | logger? | an ILogger; a line carries fixed words and logFields of a refusal, never a token or the principal | | signal? | the first party attached (attach(signal) adds more), as SncLogonProvider: the source is handed a signal that aborts when every attached party has aborted; with none live a moment waits for the source. No timeout of this package's choosing |

The four moments:

| Moment | Does | |---|---| | prepare() | asks the source for one token, checks it and drops it: a missing ticket, an unknown principal or an NTLM token fails the connect before any request. Nothing is kept | | establish() | writes nothing, answers Ok | | authorize() | asks the source for a new token, checks it, writes Authorization: Negotiate <token> through the target. Never the prepare() token or an earlier request's: a Kerberos authenticator is single-use against a service that checks for replay (measured: the replay cache refuses a token sent twice) | | rejected() | a 401 is credential-refused kerberos-ticket, with or without a WWW-Authenticate: Negotiate <token> continuation; anything else system-refused (rule 5). The provider does not follow a continuation or retry: the next authorize() brings a fresh token, retrying is the consumer's |

The source answers facts, not errors. INegotiateTokenSource.token() resolves { ok: true, token } (base64, as it goes after Negotiate ) or { ok: false, problem } with a problem of a closed list; the provider mints the refusal, so no text a source holds can reach one. Its answer is awaited as await adopts it: a native promise, a promise library's or any thenable, and read as its type says, narrowed by ok. A source that throws, rejects, or throws while its answer is read is unknown with the moment's operation. A source's token is checked before it is written: NTLM — raw (measured: a Windows runner with no domain and no ticket returns a raw NTLM NEGOTIATE message for spnego; that this is SSPI's fallback is Inference), or inside a SPNEGO token (Inference: built fixtures only) — is ntlm-token, and a token that is neither Kerberos nor NTLM, or malformed DER, is token-unreadable; no header is written for either. A source never caches a token (the contract), and a late answer after every party aborted is dropped and the moment ends interactive-login aborted (facts.outcome), no header written.

What it refuses — kind spnego, facts.problem and facts.operation (obtaining-negotiate-token at prepare(), presenting-negotiate-token at authorize()), no diagnostics. The words are the ones for obtaining-negotiate-token; at authorize() the operation phrase differs:

| problem | Found by | When | Reason | Hint | |---|---|---|---|---| | no-credential | source | no ticket (an expired one: Pending) | obtaining the Negotiate token failed: there is no Kerberos ticket, or it has expired | obtain a ticket: kinit, or the domain logon | | service-unknown | source | the KDC does not know the service principal | obtaining the Negotiate token failed: the Kerberos server does not know the service principal | check servicePrincipal against the service's registered principal | | kdc-unreachable | source | no KDC answered (none known for the realm: Pending) | obtaining the Negotiate token failed: no Kerberos server (KDC) answered | check the Kerberos configuration's realm and KDC | | clock-skew | source | the clock differs from the KDC's beyond its tolerance (Pending) | obtaining the Negotiate token failed: this machine's clock differs from the Kerberos server's beyond its tolerance | check the machine's time | | binding-unavailable | source | the source's native library could not be loaded | obtaining the Negotiate token failed: the library of the system token source could not be loaded | install the system source's native part | | source-failed | source | any other failure the source recognises as its own | obtaining the Negotiate token failed: the token source failed | | | mechanism-unsupported | source | the mechanism asked for is not supported where the source ran | obtaining the Negotiate token failed: the requested mechanism is not supported | check that the system's GSS library supports the mechanism the source was configured with | | ntlm-token | provider | the token is NTLM, raw or inside a SPNEGO token | obtaining the Negotiate token failed: the token is an NTLM token, not a Kerberos one | the service principal is not known to the domain; NTLM is not used | | token-unreadable | provider | the token is empty, not base64, or neither Kerberos nor NTLM | obtaining the Negotiate token failed: the token is empty, not base64, or neither a Kerberos nor an NTLM token | |

A 401 is the credential-refused row of What rejected() answers.

Measured on the Kerberos stand (2026-10-25, MIT krb5 1.20.1 and Apache mod_auth_gssapi, Testing): both mechanisms accepted, a fresh token per request, and each refusal above that a KDC can produce except clock-skew. Against an ABAP system it is Inference until the second stage: docs/passwordless-sso.md keeps the tags.

Migrating to 7.0.0

7.0.0 is a major because a new error kind, spnego, exists, and a consumer that switches exhaustively on kind must handle it. What a consumer on 6.x must do:

  • Add the spnego case to every exhaustive switch (error.kind) / matchKind / unreachableKind — the compiler says where, once the contract packages below are installed. A consumer that never composes SpnegoAuthProvider never receives it, but its switch must still compile.
  • Install the contract it is read with: @mcp-abap-adt/interfaces-auth ^8.0.1 and @mcp-abap-adt/auth-errors ^3.0.1 (this package's ranges; @mcp-abap-adt/interfaces-auth-sap is ^3.5.0). Keep one copy of each: npm ls @mcp-abap-adt/interfaces-auth and npm ls @mcp-abap-adt/auth-errors should show one deduplicated version.
  • Nothing else changes: no provider, option or refusal of 6.x is changed.

Installation

npm install @mcp-abap-adt/auth-providers

Overview

Every provider here is an IAuthProvider (@mcp-abap-adt/interfaces-auth 8) — prepare(), establish(), authorize(), rejected(), each answering an AuthOutcome and never throwing — handed to the process as it is. An AuthOutcome is { ok: true } or { ok: false, refusal }, the refusal an IAuthProviderError minted by @mcp-abap-adt/auth-errors: its kind and facts say what happened, reason / hint say it in words (see Error Handling):

import { AuthorizationCodeProvider, refreshThenLogin } from '@mcp-abap-adt/auth-providers';

const provider = AuthorizationCodeProvider.inBrowser({
  uaaUrl: 'https://...',
  clientId: '...',
  clientSecret: '...',
  renewal: refreshThenLogin(), // required: how every renewal proceeds
});
// A process of connection 14 or 15
// calls prepare() on connect, authorize() per request, and rejected() on a 401: one renewal through the renewal
// strategy — with refreshThenLogin(), a refresh, else one login.

What rejected() answers

A provider blames its credential only when the rejection says the credential was refused: status 401, or the RFC SDK's RFC_LOGON_FAILURE. Anything else is answered with a neutral refusal that names only the status or the SDK key. For a token provider this is a reading its renewal strategy receives (cause.reading: credential, not-credential, unknown): the shipped strategies stop on not-credential without a step and answer the neutral refusal, so nothing is renewed; a strategy of your own may renew anyway (see Renewal strategy):

| The rejection | Kind | Basic, certificate, SAML cookies, fixed token, SPNego | Token providers, TokenAuthProvider.from | |---|---|---|---| | 401, RFC_LOGON_FAILURE | credential-refused | their own refusal: Basic "the user or password was refused"; certificate "the client certificate was refused"; SAML cookies "the SAML session was refused or has expired"; fixed token "the token was refused"; SPNego "the Kerberos ticket was refused" | one renewal; Ok only if the credential changed | | 403 | system-refused not-authorized | "the credential was accepted, but the user is not authorized (403)" — "check the user's authorizations in the system" | the same, no renewal | | 3xx, e.g. 302 | system-refused redirected | "the system redirected instead of accepting the credential (302)" — "the service may require another logon procedure (single sign-on, an identity provider)" | the same, no renewal | | 5xx, e.g. 503 | system-refused system-failed | "the system failed (503), not the credential" — "try again later" | the same, no renewal | | any other status, e.g. 404 | system-refused other-status | "the system answered 404, which is not a credential refusal" | the same, no renewal | | another RFC key, e.g. RFC_COMMUNICATION_FAILURE | system-refused rfc-failure | at a logon "the RFC logon failed (RFC_COMMUNICATION_FAILURE), not as a credential refusal"; at a request "the RFC call failed (RFC_COMMUNICATION_FAILURE), not as a credential refusal" | the same, no renewal | | neither a status nor a known key | system-refused unknown | at a logon "the logon failed (unknown error)"; at a request "the request was refused (unknown error)" | one renewal — the rejection cannot tell |

SncLogonProvider explains a GSS code in the error first (A2200019, SNCERR_INIT) — the SDK reports SNC logon failures as a communication failure — and otherwise answers the same way.

The token providers also implement IRefreshableTokenProvider — ITokenProvider plus refreshTokens() — for the broker's token API:

  • ClientCredentialsProvider — client_credentials, no user interaction
  • AuthorizationCodeProvider — UAA/XSUAA authorization code, through a browser
  • UaaPasscodeProvider — UAA/XSUAA one-time passcode from /passcode, the login cf login --sso uses: SSO without a browser on this machine
  • OidcBrowserProvider — OIDC authorization code with PKCE
  • OidcDeviceFlowProvider — OAuth 2.0 device authorization grant (RFC 8628)
  • OidcPasswordProvider, OidcTokenExchangeProvider — password grant and token exchange (RFC 8693)
  • Saml2BearerProvider — a SAML assertion exchanged for an OAuth2 token (RFC 7522)
  • Saml2PureProvider — a SAML assertion exchanged for session cookies

Providers are configured via constructor; getTokens() handles refresh/login internally and takes only an optional { signal } — this caller's cancellation (see Cancelling a login). refreshTokens() obtains a new token even while the cached one looks valid — what a caller holding a 401 needs. Either throws only an AuthProviderFailure.

A token is only half of it: whether ADT accepts it depends on the XSUAA client, the trust and the user configured on the SAP side. What each provider needs there, and which are usable for ADT at all, is in docs/btp-setup.md. Logging on without a password — SAP GUI's SNC single sign-on and its HTTP equivalents, X.509 client certificates and SPNego — is in docs/passwordless-sso.md.

Since 2.0.0 an interactive login is conducted by an authorization strategy (IAuthorizationStrategy from @mcp-abap-adt/interfaces-auth) passed as authorization. The provider owns what it can compute — the authorization URL and the token exchange; everything between them (reaching the URL, receiving what comes back, the port) belongs to the strategy, which a consumer may replace wholesale. How long to wait is no one's choice but the consumer's: a login ends on its result, the identity provider's refusal or the consumer's AbortSignal. See Choosing an authorization strategy.

Since 5.3.0 a token provider's client may authenticate with a client certificate or a signed assertion instead of a secret — a strategy passed as clientAuthentication — and a token bound to that certificate is presented only together with it. See Client authentication.

Since 4.0.0 both SAML providers validate the assertion before trusting it — its signature, issuer, audience, recipient, time window, the request it answers, and whether it has been seen before — and must therefore be told which identity provider to trust. This is a breaking change: a 3.x SAML configuration fails at construction. See SAML assertion validation.

If you are on an earlier version, see Migrating to 6.0.0, Migrating to 5.0.0, Upgrading from 4.0 to 4.1, Migrating from 3.x to 4.0, Migrating from 2.x to 3.0 and Migrating from 1.x to 2.0.

Responsibilities and Design Principles

The package's parts, boundaries, principles and the decisions behind them are described in docs/architecture.md.

Core Development Principle

Interface-Only Communication: This package follows a fundamental development principle: all interactions with external dependencies happen ONLY through interfaces. The code knows NOTHING beyond what is defined in the interfaces.

This means:

  • Does not know about concrete implementation classes from other packages
  • Does not know about internal data structures or methods not defined in interfaces
  • Does not make assumptions about implementation behavior beyond interface contracts
  • Does not access properties or methods not explicitly defined in interfaces

This principle ensures:

  • Loose coupling: Providers are decoupled from concrete implementations in other packages
  • Flexibility: New implementations can be added without modifying providers
  • Testability: Easy to mock dependencies for testing
  • Maintainability: Changes to implementations don't affect providers

Package Responsibilities

This package is responsible for:

  1. Implementing token provider interface: Provides concrete implementations of ITokenProvider interface defined in @mcp-abap-adt/interfaces-auth
  2. Token acquisition: Handles OAuth2 flows (browser-based, refresh token, client credentials) to obtain JWT tokens
  3. Token validation: Validates JWT locally by checking exp claim (no HTTP requests)
  4. OAuth2 flows: Manages browser-based OAuth2 authorization code flow and refresh token flow
  5. SAML assertion validation: Verifies a SAML assertion — signature, issuer, audience, recipient, time window, request ID, replay — before either SAML provider uses it

What This Package Does

  • Implements ITokenProvider: Provides concrete implementations (AuthorizationCodeProvider, ClientCredentialsProvider)
  • Handles OAuth2 flows: Browser-based OAuth2, refresh token, and client credentials grant types
  • Obtains tokens: Makes HTTP requests to UAA endpoints to obtain JWT tokens
  • Validates tokens: Validates JWT locally by checking exp claim (no HTTP requests)
  • Returns tokens: Returns ITokenResult with authorizationToken and optional `r