Skip to content

Commit 4016cb2

Browse files
committed
chore: improve docs around remote claims related configuration for factor and options
- improving the documentation and grouping around remote claims builder's configuration and options, reducing the cognitive load (what is and what isn't related to themis' remote claims builder can be confusing and hard to follow)
1 parent 2948195 commit 4016cb2

File tree

3 files changed

+9
-15
lines changed

3 files changed

+9
-15
lines changed

token/claimBuilder.go

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -117,8 +117,7 @@ func (nc nonceClaimBuilder) AddClaims(_ context.Context, r *Request, target map[
117117
return nil
118118
}
119119

120-
// remoteClaimBuilder invokes a remote system to obtain claims. The metadata from a token request
121-
// is passed as the payload.
120+
// remoteClaimBuilder invokes a remote system to obtain claims.
122121
type remoteClaimBuilder struct {
123122
endpoint endpoint.Endpoint
124123
url string

token/factory.go

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -30,17 +30,15 @@ type Request struct {
3030
// but will not override time-based claims such as nbf or exp.
3131
Claims map[string]interface{}
3232

33-
// Metadata holds non-claim information about the request, usually garnered from the original HTTP request. This
34-
// metadata is available to lower levels of infrastructure used by the Factory.
35-
Metadata map[string]interface{}
3633

37-
// PathWildCards holds non-claim information about the request, usually garnered from the original HTTP request. This
38-
// PathWildCards is available to remote claim builders
39-
PathWildCards map[string]any
4034

4135
// TLS represents the state of any underlying TLS connection.
4236
// For non-tls connections, this field is unset.
4337
TLS *tls.ConnectionState
38+
39+
// The following fields are for remote claims' requests.
40+
Metadata map[string]any // Metadata is the request payload.
41+
PathWildCards map[string]any // PathWildCards are the request path wildcards.
4442
}
4543

4644
// NewRequest returns an empty, fully initialized token Request

token/options.go

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -201,13 +201,6 @@ type Options struct {
201201
// or statically from configuration. For special processing around the partner id, set the PartnerID field.
202202
Claims []Value
203203

204-
// Metadata describes non-claim data, which can be statically configured or supplied via a request
205-
Metadata []Value
206-
207-
// PathWildCards holds non-claim information about the request, usually garnered from the original HTTP request. This
208-
// PathWildCards is available to remote claim builders.
209-
PathWildCards []Value
210-
211204
// PartnerID is the optional partner id configuration. If unset, no partner id processing is
212205
// performed, though a partner id may still be configured as part of the claims.
213206
PartnerID *PartnerID
@@ -238,4 +231,8 @@ type Options struct {
238231
// and returns a set of claims to be merged into tokens returned by the Factory. Returned
239232
// claims from the remote system do not override claims configured on the Factory.
240233
Remote *RemoteClaims
234+
235+
// The following options are for remote claims' requests.
236+
Metadata []Value // Metadata describes the non-claim request payload, which can be statically configured or supplied via a request.
237+
PathWildCards []Value // PathWildCards are the request path wildcards, which can be statically configured or supplied via a HTTP request.
241238
}

0 commit comments

Comments
 (0)