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

PLAIN or OAUTHBEARER #2

Open
toapaxi opened this issue Jan 26, 2021 · 1 comment
Open

PLAIN or OAUTHBEARER #2

toapaxi opened this issue Jan 26, 2021 · 1 comment

Comments

@toapaxi
Copy link

toapaxi commented Jan 26, 2021

Hi,

How do you determine PLAIN or OAUTHBEARER?
Just enter the oauth_test_token function.

Change this return provider.test_password(username, token), true; and it worked

function provider.get_sasl_handler(session)
module:log("warn", "PRUEBA DE CTO");
local supported_mechanisms = {};
supported_mechanisms["OAUTHBEARER"] = true;
supported_mechanisms["PLAIN"] = true;
return new_sasl(host, {
plain_test = function(sasl, username, password, realm)
return provider.test_password(username, password), true;
end,
oauthbearer = function(sasl, username, token, realm)
return provider.test_password(username, token), true;
--return oauth_test_token(username, token, realm), true;
end,
mechanisms = supported_mechanisms
});
end

Great job!!!!!
Regards,
Chrystiam

@paulb-smartit
Copy link

it doesn't work like that. You don't choose. The first time out if there's a password it will use PLAIN. Next call if it has a token it will use OUTHBEARER.

This solved an issue for use and we now have prosody authenticating against keycloak.

One error we made was including the protocol https:// in the variable oauth_host. It was very difficult to find because it never gets to the keycloak service so nothing is logged. An http 400 Bad Request error gets returned eventually spotted client sent invalid host header while reading client request headers in the Nginx logs pointing to host: "https://sso.domain.tld.

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

No branches or pull requests

2 participants