Skip to content

Commit 596fdc3

Browse files
authored
Merge pull request #19 from WebFuzzing/improved-token-handling
auth: improve TokenHandling
2 parents d480e2b + 2d73ede commit 596fdc3

File tree

1 file changed

+34
-10
lines changed

1 file changed

+34
-10
lines changed

src/main/resources/wfc/schemas/auth.yaml

Lines changed: 34 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -129,21 +129,45 @@ $defs:
129129
required: ["verb"]
130130
###
131131
TokenHandling:
132-
description: "Specify how to extract token from response, and how to use it for auth in following requests. \
132+
description: "Specify how to extract the token from the HTTP response, and how to use it for auth in following requests. \
133133
Not needed if rather expect to get back a cookie."
134134
type: object
135135
properties:
136-
extractFromField:
137-
description: "How to extract the token from a JSON response, as such JSON could have few fields, possibly nested. \
138-
It is expressed as a JSON Pointer (RFC 6901)."
136+
extractFrom:
137+
description: "Specify from where the token should be extracted in the HTTP response."
139138
type: string
140-
httpHeaderName:
141-
description: "When sending a token in an HTTP header, specify to which header to add it (e.g., 'Authorization')."
139+
enum: ["body", "header"]
140+
extractSelector:
141+
description: "How to extract the token from the HTTP response. \
142+
This depends on where the token is located. \
143+
For a 'body' location, the returned body payload like a JSON could have few fields, possibly nested. \
144+
In this case, this selector is expressed as a JSON Pointer (RFC 6901). \
145+
For a 'header' location, this selector would represent the name of the HTTP header (e.g., 'X-Auth-Token')."
142146
type: string
143-
headerPrefix:
144-
description: " When sending out the obtained token in an HTTP header, specify if there should be any \
145-
prefix (e.g., 'Bearer ' or 'JWT '). If needed, make sure it has trailing space(s)."
147+
sendIn:
148+
description: "The obtained auth token could be send for authentication in following requests in different ways. \
149+
For example, in a HTTP header (e.g., 'Authorization') or a query parameter."
146150
type: string
151+
enum: ["header", "query"]
152+
sendName:
153+
description: "Header or query name where the token should be put in the authenticated requests. \
154+
Typically, for a header, this would be 'Authorization'."
155+
type: string
156+
examples:
157+
- "Authorization"
158+
sendTemplate:
159+
description: "Template with {token} placeholder. \
160+
The placeholder will be interpolated with the actual token value. \
161+
When sending out the obtained token in an HTTP request, specify if there should be any other \
162+
text information around it. \
163+
For example, when sending the token in an 'Authorization' header, possible \
164+
values could be 'Bearer {token}' and 'JWT {token}'."
165+
type: string
166+
default: "{token}"
167+
examples:
168+
- "Bearer {token}"
169+
- "JWT {token}"
170+
required: ["extractFrom", "extractSelector", "sendIn", "sendName"]
147171
###
148172
PayloadUsernamePassword:
149173
description: "Payload with username and password information. \
@@ -162,4 +186,4 @@ $defs:
162186
passwordField:
163187
description: "The name of the field in the body payload containing the password"
164188
type: string
165-
required: ["username","usernameField","password","passwordField"]
189+
required: ["username","usernameField","password","passwordField"]

0 commit comments

Comments
 (0)