Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Proposal: Enhance Custom Authorization Abilities #415

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

adrianosela
Copy link

@adrianosela adrianosela commented Oct 14, 2024

Description

This PR is a proof-of-concept for extending the ability to write custom authorizers beyond using a custom function to check the value of a string (username in the existing AuthFunc function definition), and specifically facilitating mTLS authentication.

I would like my TURN communication to happen over TLS (which is already possible today), but I would like my TURN clients to present a signed TLS certificate for authn/authz instead of a static username and password.

This PR demonstrates how this could be possible.

This breaks the existing API - but it doesn't need to. Both AuthHandler and Authorizer could co-exist until the next major release (assuming there's interest in this change).

Note that internal/server/authz/tls.go is only included for illustrative purposes -- that shound't go in here... though perhaps maybe an /example would be worthwhile.

Copy link

codecov bot commented Oct 15, 2024

Codecov Report

Attention: Patch coverage is 54.54545% with 20 lines in your changes missing coverage. Please review.

Project coverage is 67.78%. Comparing base (cc03474) to head (c4e36b1).

Files with missing lines Patch % Lines
internal/server/authz/tls.go 0.00% 17 Missing ⚠️
server.go 78.57% 2 Missing and 1 partial ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           master     #415      +/-   ##
==========================================
- Coverage   68.15%   67.78%   -0.38%     
==========================================
  Files          43       45       +2     
  Lines        2352     2387      +35     
==========================================
+ Hits         1603     1618      +15     
- Misses        582      601      +19     
- Partials      167      168       +1     
Flag Coverage Δ
go 67.78% <54.54%> (-0.38%) ⬇️
wasm 27.48% <0.00%> (-0.41%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@rg0now
Copy link
Contributor

rg0now commented Oct 16, 2024

This seems like a really useful addition, I suggest we merge it with minor modifications.

This breaks the existing API - but it doesn't need to. Both AuthHandler and Authorizer could co-exist until the next major release (assuming there's interest in this change).

I think it's OK to break the API with a new major version, it's still better than the confusion two auth handler APIs would create. Plus, the new API seems extensible without another API break.

Note that internal/server/authz/tls.go is only included for illustrative purposes -- that shound't go in here... though perhaps maybe an /example would be worthwhile.

I'm OK with providing this is a prefab functionality, mTLS seems useful and general enough to warrant a built-in implementation. Do you think your implementation is reusable for other users?

But examples/ will definitely need some love. Mostly straightforward porting, but we should make sure each example works.

@adrianosela
Copy link
Author

This seems like a really useful addition, I suggest we merge it with minor modifications.

Which modifications do you suggest? Happy to do 'em. @rg0now

cc:// @Sean-Der

@rg0now
Copy link
Contributor

rg0now commented Oct 16, 2024

Which modifications do you suggest? Happy to do 'em. @rg0now

Just updating the examples/, nothing serious

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

2 participants