http-extensions icon indicating copy to clipboard operation
http-extensions copied to clipboard

Add SF-based Authorization and WWW-Authenticate headers

Open chris-wood opened this issue 2 years ago • 15 comments

This seems like another good candidate for a structured format. Maybe something we can add to the retrofitted structured headers draft as a new set of mapped fields?

chris-wood avatar Oct 31 '22 19:10 chris-wood

This is attractive, but it would require each auth scheme that wanted to use the new mapped fields to define how to convert the "normal HTTP" form into structured fields.

I suppose we could say that a scheme MUST NOT be used in the mapped field unless it defined such a conversion, and we could do the common ones to start (likely: Basic, Digest, Bearer).

That's not a small amount of work, and I half wonder whether it should be in a separate spec.

Thoughts?

mnot avatar Dec 05 '22 05:12 mnot

I don't have a strong opinion about where the work should be done, but it doesn't seem like a whole lot of work (saying that without having actually tried to make the change). In any case, this seems like a reasonable path forward to me. If no one volunteers to do it, I can give it a shot in the new year.

chris-wood avatar Dec 05 '22 16:12 chris-wood

I believe the mapping is straight-forward.

WWW-A would be a list of parametrized tokens. The token would take the scheme name, and its parameters would be the auth-params.

There's only the special case of Basic auth, where we don't have auth-params but a single token68 value. Mapping that to a specific param name shouldn't be big issue.

If people want this, I can give it a try.

reschke avatar Dec 05 '22 16:12 reschke

@reschke please do, but realise that you'll need to map each parameter name to a type -- possible with a converstion -- for each scheme.

mnot avatar Dec 06 '22 01:12 mnot

That's of course impossible as it is open-ended. Why would that be required?

reschke avatar Dec 06 '22 07:12 reschke

The proposal isn’t to create a compatible field, it’s to create a mapped one. That requires definition of a mapping.

mnot avatar Dec 06 '22 08:12 mnot

Yes, but I don't see why we need to define the types.

If auth scheme "foo1" has a parameter "bar" that is integer-typed, and auth scheme "foo2" has a parameter "bar" that is string-typed, why is that a problem?

What we can say is that - as auth params are either token or quoted-string, so will be the SF params (sf-token or sf-string).

reschke avatar Dec 06 '22 09:12 reschke

Who defines those types?

mnot avatar Dec 06 '22 10:12 mnot

What do you mean by "those types"? The types of auth-params for a specific scheme?

reschke avatar Dec 06 '22 10:12 reschke

Yes.

mnot avatar Dec 21 '22 01:12 mnot

We can either let the scheme define them, or just say "sf-token or sf-string", mapping what the current syntax allows.

reschke avatar Dec 21 '22 10:12 reschke

Yes, but that's not realising the value of using SF. Ideally we'd define the mappings for most existing schemes, falling back to that for unrecognised schemes.

Julian, were you going to attempt a PR?

mnot avatar Dec 23 '22 04:12 mnot

Julian, were you going to attempt a PR?

Depends on what you're looking for. I can write down a generic mapping for all schemes that use the generic syntax properly. I don't believe doing more would be useful.

reschke avatar Dec 23 '22 17:12 reschke

I'd love to see us define the fields for some schemes as a template, and explain to new auth schemes how they could define themselves using structured fields. So, don't claim to be complete, but point out how new documents can refer to structured fields without having them being outside the context of structured types.

tfpauly avatar Mar 31 '23 01:03 tfpauly

Here's an example of where we are writing new auth schemes and have to have somewhat involved text about when you have quotes, etc: https://www.ietf.org/archive/id/draft-ietf-privacypass-auth-scheme-09.html#section-2.1-8

tfpauly avatar Mar 31 '23 01:03 tfpauly