credentialtest

package
v0.27.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Dec 1, 2026 License: AGPL-3.0 Imports: 33 Imported by: ? modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package credentialtest exercises plugin credential providers and consumers without installing a host. Mount starts an isolated in-process go-plugin pair with real mutually authenticated sockets, negotiation, strict admission and callback binding. The scripted host is test support, not a vault, policy engine or production host.

What is real: the broker, mutual TLS, bind proof, raw-frame admission and the SDK's delivery checks run unchanged. What is scripted: the host's decisions (which leases a slot holds, which inputs an issuer receives, what a prompt answers). The harness applies the host prerequisites it can express: a script bound to a consumer slot must be valid, and an issuer is only asked to issue for a key Discover returned. What the test supplies to an issuer as an input is handed over as given: the SDK's adapter refuses a defective one (a wrong type, malformed material, an expired or overlong lease, an undefined revocation class) only when the issuer fetches it, so the harness does not refuse it first; an input the test leaves out is simply not delivered. It does not implement a production host's grants, storage or policy, so a passing test shows a plugin handles the host contract, not that a particular host would authorize it.

The outcome of a cancelled or timed-out Issue, Renew or Resume is unknown, here as behind a real host: the issuer may have run, may still be running, or may start after the call returned. A pending ticket is therefore spent as soon as its request is handed to the transport, whatever follows, and restored only after a refusal the harness made itself before handing anything over. An issuer must make a repeated resume of the same pending handle safe, because a real host may deliver one again, with a fresh operation ID.

Importing this package mounts nothing and installs no clock, broker or hook. It links the same packages as pkg/credential, and so the strict gRPC codec those register process-wide: a program that already imports pkg/credential or pkg/sdk is unchanged, while one that imports neither gains that codec. Only a mounted pair uses its test clock.

Time moves only through Harness.Advance. The mounted clock is frozen at the wall-clock instant of Mount (see WithStartTime and WithClock) and every mounted peer reads it, never time.Now. An issuer under test that calls time.Now is therefore judged against a clock that does not follow it once Advance moves the harness: after Advance, compute expiry from Harness.Now, or pass the issuer the clock given to WithClock.

An external module needs the SDK's gRPC fork replacement, which Go does not inherit from this module; see docs/resource-v2-api.md, "Source-session transport".

HashiCorp go-plugin's Serve starts two stdio copyChan readers in newGRPCStdioServer, even in test mode. After Retire joins the plugin and its runner, only those readers may remain until Go finalizes the pipe writers.

Index

Examples

Constants

View Source
const (
	MethodValidate   = "Validate"
	MethodDescribe   = "Describe"
	MethodImport     = "Import"
	MethodDiscover   = "Discover"
	MethodIssue      = "Issue"
	MethodRenew      = "Renew"
	MethodRevoke     = "Revoke"
	MethodObserve    = "Observe"
	MethodGet        = "Get"
	MethodInvalidate = "Invalidate"
	MethodWatch      = "Watch"
	MethodPrompt     = "Prompt"
	MethodTarget     = "Target"
)

The operations recorded in Call.Method. Compare against these constants: Count and AssertCalls refuse any other name instead of silently matching nothing.

Variables

This section is empty.

Functions

This section is empty.

Types

type Attempt

type Attempt struct {
	Interactive bool
	Inputs      map[string]credential.Lease `json:"-"`
	Prompts     []PromptReply               `json:"-"`
	Target      []credential.Claim          `json:"-"`
	MaxTTL      time.Duration
	Lease       *credential.Lease `json:"-"`
	// contains filtered or unexported fields
}

Attempt grants host callbacks for one Issue, Renew or Resume RPC. The zero value is silent, with no inputs. Inputs are borrowed for this call only.

The harness dispatches with exactly the inputs the test supplies, as a host may. A declared input the test leaves out is not delivered, so the issuer's own handling of it is what the test observes: it receives the typed credential.ErrCredentialRequired naming the slot, an issuer with a legitimate fallback (or a silent renewal which needs no input) succeeds, and one which hides that failure is judged by the SDK's real adapter, as it would be behind a real host.

A supplied input is handed over as given. The harness does not judge its type, its material, its expiry or lifetime or its revocation class: the SDK's host adapter judges all of them only when the issuer fetches the input, and refuses a defective one with the Internal class, exactly as behind a real host. An issuer which never fetches a defective input succeeds; one which fetches it is refused. (The leases of a consumer's Bind script are a different contract: a script which breaks a rule fails at Bind.) What the harness refuses before calling the plugin are the host's own prerequisites: a name the issuer does not declare (credential.ErrUnknownSlot), more inputs than a frame carries, an input whose identity changed or whose revision went back since an earlier attempt of the same chain, and an input which a withdrawal denied (credential.ErrAccessRequired). An input which expires while the attempt runs withholds the issued lease (credential.ErrLeaseExpired), as a host which rechecks its grants after an upstream call would.

Four fields are filled when omitted, as Bind fills them: a handle, revision 1, the test issuer and TTLBound. A real host which hands over the same lease with one of them missing is refused at fetch, so set all four to see that outcome.

Renew and resume keep the identity of the inputs they started with. An omitted input handle or revision repeats the first attempt's; an explicit handle, type or issuer that differs, or a revision lower than one already given to the plugin by an earlier attempt (whether or not its issuer then succeeded), is refused. A revision may advance. An omitted issuer does not repeat: it is the test issuer again, so a continuation of an input which named another issuer must name it again. Each attempt still gets fresh source references and a fresh operation ID. Prompts must match in order. Target applies only to Issue. A resume retains its original target and MaxTTL; leave them unset or repeat them exactly.

To inspect the actual projection, set Lease to an exclusively owned, zero credential.Lease. An issued result transfers its material and detached handles to that destination; pending or failed attempts leave it unchanged. Wipe the lease after use. To exercise both roles, pass it explicitly to Bind, keep it immutable until Retire returns, then wipe it. Neither the issuer receipt nor a later renewal redirects an existing consumer binding.

Treat an Attempt and its fields as protected. Do not mutate them during a call or pass them to a logger, even though normal formatting is redacted.

func (Attempt) Format

func (Attempt) Format(s fmt.State, _ rune)

func (Attempt) GoString

func (Attempt) GoString() string

func (Attempt) GobEncode

func (Attempt) GobEncode() ([]byte, error)

func (Attempt) MarshalJSON

func (Attempt) MarshalJSON() ([]byte, error)

func (Attempt) String

func (Attempt) String() string

type Call

type Call struct {
	Method   string
	Slot     string
	Issuer   string
	Revision uint64
	Prompt   credential.PromptKind
	// contains filtered or unexported fields
}

Call describes an operation that reached the mounted plugin or a host callback, never its material, references, prompt contents or answer. A plugin operation is recorded when the plugin's server admits its frame, before any author code runs, and only then. One the SDK or this harness refused before anything left the host (an undeclared issuer or type, an unsupported renewal or revocation, an invalid script, a stale receipt, a context which had already ended) is never recorded: the history counts what reached the plugin, not attempts. A frame the host stopped waiting for (a cancelled or timed-out Issue, Renew or Resume) is recorded whenever the plugin admits it, even after that call returned. The issuer may still run for it: the request can reach the plugin, and the issuer can start, after the host stopped waiting; if the frame is still parked when the plugin sees the cancellation it is refused at native entry and the issuer does not run, and the host cannot tell which. The history therefore does not say whether a pending ticket is spent: the ticket is spent once its request was handed to the transport, and after a cancellation the outcome is unknown, so wait for the issuer's own signal rather than for a count. Slot and Issuer are declared names, not opaque IDs or values from a peer failure. The blank first field makes a positional literal fail to compile: write the field names, because later releases may add fields.

type Harness

type Harness struct {
	// contains filtered or unexported fields
}

Harness owns one isolated plugin, one profile and one fake host. Do not copy it. Issue operations and credential callbacks may run concurrently. Serialize profile changes (Bind, Start, Remove) in the test, and do not retire from a mounted callback.

func Mount

func Mount(t testing.TB, owner string, opts credential.PluginOpts, options ...Option) *Harness

Mount registers the supplied declarations as one installed plugin. An invalid declaration, option, negotiation or bind fails the test. Test cleanup retires both peers. Without options the mounted clock starts at the wall-clock instant of the call and then moves only through Advance.

Example (Consumer)

A managed HTTP client reaches a TLS server through credentialhttp. The scripted host holds two revisions of one slot; the target rejects the first, so the transport reports the rejection and sends the replacement.

package main

import (
	"context"
	"crypto/x509"
	"fmt"
	"net/http"
	"net/http/httptest"

	"github.com/omniviewdev/plugin-sdk/pkg/credential"
	"github.com/omniviewdev/plugin-sdk/pkg/credential/credentialhttp"
	"github.com/omniviewdev/plugin-sdk/pkg/credential/credentialtest"
)

func bearerLease(token string) credential.Lease {
	return credential.Lease{Type: credential.TypeBearer, Expiry: credential.Static(),
		Material: credential.Bearer([]byte(token))}
}

// A managed HTTP client reaches a TLS server through credentialhttp. The scripted host holds two
// revisions of one slot; the target rejects the first, so the transport reports the rejection
// and sends the replacement.
func main() {
	t := newExampleT() // An Example has no *testing.T; in a test, pass your own.
	defer t.Close()
	ctx := t.Context()

	h := credentialtest.Mount(t, "images", credential.PluginOpts{
		Slots: []credential.Slot{{Name: "registry", Accepts: []string{credential.TypeBearer}}}})
	target := httptest.NewTLSServer(h.Target(http.StatusUnauthorized, http.StatusOK))
	defer target.Close()
	roots := x509.NewCertPool()
	roots.AddCert(target.Certificate())

	if err := h.Bind(ctx, map[string][]credential.Lease{
		"registry": {bearerLease("first-token"), bearerLease("second-token")},
	}); err != nil {
		panic(err)
	}
	var client *http.Client
	err := h.Start(ctx, func(create context.Context) (func(), error) { // A real managed client generation.
		source, err := credential.SourceFor(create, "registry")
		if err != nil {
			return nil, err
		}
		transport, err := credentialhttp.NewBearerTransport(source, target.URL, credentialhttp.WithRootCAs(roots))
		if err != nil {
			return nil, err
		}
		client = &http.Client{Transport: transport}
		return client.CloseIdleConnections, nil
	})
	if err != nil {
		panic(err)
	}

	request, err := http.NewRequestWithContext(ctx, http.MethodGet, target.URL, nil)
	if err != nil {
		panic(err)
	}
	response, err := client.Do(request)
	if err != nil {
		panic("managed HTTP call failed") // Never print err: http.Client's wrapper contains the URL.
	}
	defer response.Body.Close()

	fmt.Println(response.StatusCode, h.Count(credentialtest.Call{
		Method: credentialtest.MethodInvalidate, Slot: "registry", Revision: 1}))
}
Output:
200 1
Example (Provider)

This provider has one issuer. It needs one upstream credential and asks the user to sign in. Mount runs its real callbacks behind the real SDK transports; only the host is scripted.

package main

import (
	"context"
	"fmt"
	"time"

	"github.com/omniviewdev/plugin-sdk/pkg/credential"
	"github.com/omniviewdev/plugin-sdk/pkg/credential/credentialtest"
)

// A device-code sign-in: the host presents it, the issuer never sees an answer.
func deviceSignIn() credential.DeviceCodePrompt {
	return credential.DeviceCodePrompt{VerificationURI: "https://signin.example.test/device", UserCode: "ABCD-1234"}
}

// This provider has one issuer. It needs one upstream credential and asks the user to sign in.
// Mount runs its real callbacks behind the real SDK transports; only the host is scripted.
func main() {
	t := newExampleT() // An Example has no *testing.T; in a test, pass your own.
	defer t.Close()
	ctx := t.Context()

	issuer := credential.Issuer{
		ID: "login", Produces: credential.TypeBearer, Revocation: credential.TTLBound,
		Requires:    []credential.Slot{{Name: "upstream", Accepts: []string{credential.TypeBearer}}},
		Interaction: []credential.PromptKind{credential.KindDeviceCode},
		Discover: credential.OneCandidate("robot", credential.Metadata{
			Type: credential.TypeBearer, IdentityLabel: "Release robot"}),
		Issue: func(ctx context.Context, r credential.IssueRequest) (credential.IssueResult, error) {
			upstream, err := r.Input(ctx, "upstream") // The host supplies this lease and checks its type.
			if err != nil {
				return nil, err
			}
			defer upstream.Wipe()
			if _, err = r.Prompt(ctx, deviceSignIn()); err != nil {
				return nil, err
			}
			return credential.Issued(credential.Bearer([]byte("derived-token")), credential.Static()), nil
		},
	}
	h := credentialtest.Mount(t, "registry", credential.PluginOpts{Issuers: []credential.Issuer{issuer}})

	candidates, err := h.Discover(ctx, "login")
	if err != nil {
		panic(err)
	}
	upstream := credential.Lease{Type: credential.TypeBearer, Material: credential.Bearer([]byte("upstream-token")),
		Expiry: credential.Until(h.Now().Add(time.Hour))}
	result, err := h.Issue(ctx, "login", candidates[0].Key, credentialtest.Attempt{
		Interactive: true, // Silent attempts are refused with credential.ErrInteractionRequired.
		Inputs:      map[string]credential.Lease{"upstream": upstream},
		Prompts:     []credentialtest.PromptReply{{Challenge: deviceSignIn(), Disposition: credential.PromptPresented}},
	})
	fmt.Println(result.Status, err)

	// Only dispatched operations are counted, by declared names and kinds, never by content.
	fmt.Println(h.Count(credentialtest.Call{Method: credentialtest.MethodIssue, Issuer: "login"}),
		h.Count(credentialtest.Call{Method: credentialtest.MethodPrompt, Issuer: "login", Prompt: credential.KindDeviceCode}))
}
Output:
ACTIVE <nil>
1 1

func (*Harness) Advance

func (h *Harness) Advance(d time.Duration)

Advance synchronously runs all scripted replacement and expiry transitions due at the new fake time. A renew-after hint consumes the next scripted lease; without a replacement the current lease remains usable only until finite expiry. A scripted replacement that has already expired at the new time is skipped, never announced as active.

A replacement is never announced as active if a parent of it is gone when the tick ends: one which a withdrawal before the tick already denied ends the binding unbound, as Rotate would (the rest of its script is dropped), and one whose parent expires or is withdrawn in this very tick is not announced either. The whole tick is resolved before any of it is announced, so a watcher hears the same sequence whatever order the bindings were visited in, and a binding which ends the tick withdrawn announces only that withdrawal.

An issuer input is never touched by the tick: it is handed over as supplied, and its expiry is judged by the SDK's adapter when an issuer fetches it, as eligibleLocked does. An attempt which is running while the clock passes the expiry of its input is still refused at publication with credential.ErrLeaseExpired, and a later attempt which supplies the same expired input is dispatched.

func (*Harness) AssertCalls

func (h *Harness) AssertCalls(want ...Call)

AssertCalls checks the complete ordered history. Failure reports counts and the first mismatch index, never either event: even mistaken expectations may be secret. An expectation whose Method is not one of the Method constants fails at its index.

func (*Harness) Bind

func (h *Harness) Bind(ctx context.Context, slots map[string][]credential.Lease) error

Bind replaces the complete slot set for the single test profile. It revokes old references before stopping the native client, installs fresh references at a strictly newer binding revision, and never starts a client implicitly. Even removing and recreating the profile does not reuse a reference or revision. Mount already ran the protocol bind; Bind attaches this script to the profile's slots.

Supply each declared slot's leases in delivery order; an undeclared slot is credential.ErrUnknownSlot. Every lease needs a type its slot accepts, material which is present, within the SDK's size limits and, for a canonical type, complete, an expiry (Until, Static or UnknownUntilRejected) and, if it names one, a revocation class the SDK defines. Revisions must strictly increase. A handle or parent that an earlier withdrawal or replacement denied is refused, including one denied while Bind runs: the check is repeated where the references publish, under the lock the withdrawal takes, so Bind never succeeds for a lease whose parent is denied. A script that breaks a rule fails here, naming the lease's position and the rule, never later as an opaque delivery failure. An omitted handle, revision, issuer or revocation class defaults to a fresh handle, the next revision, the test issuer or TTLBound respectively. Not every lease the SDK can never deliver is caught here: one whose expiry lies beyond its maximum lifetime when it is delivered, whose renew-after hint lies beyond its expiry, or whose issuer reference names no plugin or no issuer passes Bind and fails every Get with the Internal class. These are the rules of a consumer's script. The leases a test hands an issuer as Attempt.Inputs are not checked this way: the SDK's adapter refuses a defective input only when the issuer fetches it. The fake host borrows the supplied lease bytes read-only until Retire returns; the real transport delivers fresh caller-owned bytes on every successful Get.

func (*Harness) Calls

func (h *Harness) Calls() []Call

Calls returns an independent snapshot in observation order. Concurrent operations need not arrive in any particular order; use Count when ordering is not a contract.

func (*Harness) Count

func (h *Harness) Count(want Call) int

Count counts exact matches, including zero-valued fields. A Method that is not one of the Method constants fails the test, whatever else it names, instead of silently counting nothing.

func (*Harness) Describe

func (h *Harness) Describe(ctx context.Context, id string, material credential.Material) (credential.Metadata, error)

Describe asks the mounted type handler for metadata, not native validation.

func (*Harness) Discover

func (h *Harness) Discover(ctx context.Context, issuer string) ([]credential.Candidate, error)

Discover obtains the issuer's metadata-only candidate snapshot. Issue accepts only a key from the latest snapshot returned for the same issuer, as a host offers only keys an issuer has just discovered.

func (Harness) Format

func (Harness) Format(s fmt.State, _ rune)

func (Harness) GoString

func (Harness) GoString() string

func (Harness) GobEncode

func (Harness) GobEncode() ([]byte, error)

func (*Harness) Import

Import sends a protected document to its mounted handler. The caller owns any returned draft material and should wipe it after its assertions.

func (*Harness) Issue

func (h *Harness) Issue(ctx context.Context, issuer, candidate string, a Attempt) (IssuerResult, error)

Issue calls the mounted issuer for the selected candidate. The harness keeps only the protected state needed to continue the lifecycle, not a second copy of the material. A pending result authorizes no lease delivery. The candidate must come from Discover and every declared input must be supplied (see Attempt); a refusal on either count calls no plugin code.

func (Harness) MarshalJSON

func (Harness) MarshalJSON() ([]byte, error)

func (*Harness) Now

func (h *Harness) Now() time.Time

Now returns this harness's current simulated time, including in provider callbacks. It starts at the wall-clock instant of Mount (or the WithStartTime instant) and moves only through Advance. Issuer code under test that reads time.Now instead does not follow it.

func (*Harness) Observe

func (h *Harness) Observe(ctx context.Context, result IssuerResult) (credential.Observation, error)

Observe queries the issuer, not a cached status. A confirmed revocation retires the receipt and clears its host-owned handle and private state.

func (*Harness) Remove

func (h *Harness) Remove(ctx context.Context) error

Remove revokes all of this profile's references before publishing its removal to the real resource controller. Issuer input references belong to their attempts.

func (*Harness) Renew

func (h *Harness) Renew(ctx context.Context, result IssuerResult, a Attempt) (IssuerResult, error)

Renew extends one issued revision. The host handle is unchanged on success; the old receipt cannot address the replacement revision. A pending renewal leaves its old receipt available for Observe or Revoke between attempts, and so does a renewal whose outcome is unknown (cancelled or timed out): only the pending ticket it may have produced is spent, as Resume describes. That old receipt may be passed to Renew, Observe or Revoke again.

func (*Harness) Resume

func (h *Harness) Resume(ctx context.Context, result IssuerResult, a Attempt) (IssuerResult, error)

Resume spends a pending receipt on a fresh attempt of the same Issue or Renew. Advance past the retry hint to poll, or present a scripted form or loopback answer immediately on an explicitly interactive resume. Neither a silent call nor another receipt can receive that answer. A chain permits at most eight resumes in one hour of harness time; a resume the harness refuses itself does not count.

The receipt is spent as soon as the request is handed to the transport, whatever follows: success, failure, cancellation, a deadline, an issuer which never started. The outcome of a cancelled or timed-out attempt is unknown here as it is for a real host (the issuer may have run, may still be running, or may start after the call returned), so the same ticket is never offered again. Only a refusal the harness makes itself before handing anything over leaves the receipt unspent: an input it refuses, a retry hint which is not yet due, an answer for a silent resume, a changed target or lifetime, or a context which had already ended. An issuer must still make a repeated resume of the same pending handle safe, because a real host may deliver one again, with a fresh operation ID. The harness never offers a spent ticket again, and refuses its receipt like any stale one: after a cancellation start a new Issue to run the flow again.

func (*Harness) Retire

func (h *Harness) Retire()

Retire permanently revokes all references, stops the authenticated bind, and joins the in-process plugin. It is idempotent. No test clock tick is necessary.

func (*Harness) Revoke

func (h *Harness) Revoke(ctx context.Context, result IssuerResult) (credential.Observation, error)

Revoke stops local delivery of this handle and its dependants before contacting the issuer, even if it has no remote kill switch. It abandons pending renewal. An uncertain result is not confirmation; a verified issuer retains its private state until Observe confirms revocation.

func (*Harness) Rotate

func (h *Harness) Rotate(slot string) error

Rotate publishes the next scripted lease under the same binding and native generation. Watchers get a revision, never bytes; call Get for the replacement.

func (*Harness) Start

func (h *Harness) Start(ctx context.Context, create func(context.Context) (func(), error)) error

Start runs create in a real managed CreateClient generation. The returned function, if non-nil, is its DestroyClient cleanup (for example CloseIdleConnections). A start failure keeps the normal resource-domain classification. Rebind to replace a running test generation; a second Start cannot silently skip create.

func (Harness) String

func (Harness) String() string

func (*Harness) Target

func (h *Harness) Target(statuses ...int) http.Handler

Target returns an HTTP handler that sends the scripted final statuses, one per network request. Use it with httptest.NewTLSServer and the adapter's explicit test root. Extra requests fail the test; the handler records only a Target event and never reads or records an Authorization header or URL.

func (*Harness) Validate

func (h *Harness) Validate(ctx context.Context, id string, material credential.Material) error

Validate runs the schema and native validators on the mounted type handler. Only a call that reaches the plugin is recorded.

func (*Harness) Withdraw

func (h *Harness) Withdraw(slot string) error

Withdraw stops local delivery and notifies watchers at a new revision. It also fences every lease issued through this one as an issuer input, whether that descendant is bound to a slot, an issued intermediate nobody bound, or further along the chain, and every revision of such a lease: one a slot still serves stops with the later ones, however many renewals followed it. It does not claim remote revocation.

type IssuerResult

type IssuerResult struct {
	Status     credential.ReplacementStatus
	Revision   uint64
	RetryAfter time.Duration
	// contains filtered or unexported fields
}

IssuerResult is a material-free receipt from one Harness. Status is Active or PendingApproval. RetryAfter is positive only for pending work. Revision is zero until first issue, and increases on successful renewal. Pass the unmodified receipt back to the same harness; never reconstruct it.

type Option

type Option struct {
	// contains filtered or unexported fields
}

Option adjusts one Mount. Supply each kind at most once. A malformed or conflicting option fails the test at Mount with a message naming the problem. The zero Option is invalid.

func WithClock

func WithClock(clock *timeutil.FakeClock) Option

WithClock mounts both peers on clock instead of a clock the harness owns. Give the same clock to an issuer under test so its expiry calculations follow Harness.Advance. The clock must be an initialised, frozen fake clock (timeutil.NewFakeClock) reading an instant in years 1000 through 8999 (UTC), as WithStartTime requires: a nil, zero-value or instant (timeutil.NewInstantFakeClock) clock follows the wall clock, so Mount fails the test instead of accepting it. Move the clock only through Harness.Advance: replacements and expiries scripted for the new time run only there, and time must never move backwards. The mount does not take ownership of the clock, and one clock must not be shared by two mounts (each Advance would move the other's time). WithClock cannot be combined with WithStartTime.

func WithStartTime

func WithStartTime(at time.Time) Option

WithStartTime starts the harness-owned clock at exactly the given instant instead of the wall-clock instant of Mount. The clock stays frozen there until Advance. It accepts years 1000 through 8999 (UTC); Mount fails the test for any other instant, including the zero time, rather than starting somewhere else. It cannot be combined with WithClock.

type PromptReply

type PromptReply struct {
	Challenge   credential.Prompt `json:"-"`
	Disposition credential.PromptDisposition
	Timeout     bool
	Answer      []byte `json:"-"`
	// contains filtered or unexported fields
}

PromptReply authorizes one exact challenge, including its destination, form fields or loopback session. Set Disposition to Presented, Denied or Cancelled (the credential.Prompt* constants). Alternatively set Timeout alone to simulate a deadline without waiting. An unexpected challenge fails closed.

Only the final, presented form or loopback challenge may have an Answer. The host never returns it from Prompt. If that attempt returns Pending, the host seals a copy for its next interactive Resume and clears it after use.

func (PromptReply) Format

func (PromptReply) Format(s fmt.State, _ rune)

func (PromptReply) GoString

func (PromptReply) GoString() string

func (PromptReply) GobEncode

func (PromptReply) GobEncode() ([]byte, error)

func (PromptReply) MarshalJSON

func (PromptReply) MarshalJSON() ([]byte, error)

func (PromptReply) String

func (PromptReply) String() string

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL