Only enable resource owner password grant flow if ldap or pam is enabled

Resource Owner Password Grant flow is considered insecure and should not generally be used. It seems that both PAM and LDAP seem to require it, which is unfortunate, but this at least improves the security of servers that aren't using those.
This commit is contained in:
Emelia Smith 2023-09-16 18:30:13 +02:00
parent bd06c13204
commit bf8d132557
No known key found for this signature in database

View File

@ -164,7 +164,11 @@ Doorkeeper.configure do
# http://tools.ietf.org/html/rfc6819#section-4.4.3
#
grant_flows %w(authorization_code password client_credentials)
if Devise.ldap_authentication || Devise.pam_authentication
grant_flows %w(authorization_code client_credentials password)
else
grant_flows %w(authorization_code client_credentials)
end
# Under some circumstances you might want to have applications auto-approved,
# so that the user skips the authorization step.