Commit 04ab63a1 authored by Dylan Griffith's avatar Dylan Griffith

Merge branch 'improve-scim-code-quality' into 'master'

Refactor scim to improve code quality

See merge request gitlab-org/gitlab!25773
parents d803d950 d34aaa8c
......@@ -45,16 +45,18 @@ module API
render_scim_error(EE::Gitlab::Scim::Conflict, message)
end
def check_access_to_group!(group)
token = Doorkeeper::OAuth::Token.from_request(current_request, *Doorkeeper.configuration.access_token_methods)
unauthorized! unless token && ScimOauthAccessToken.token_matches_for_group?(token, group)
end
def find_and_authenticate_group!(group_path)
group = find_group(group_path)
scim_not_found!(message: "Group #{group_path} not found") unless group
token = Doorkeeper::OAuth::Token.from_request(current_request, *Doorkeeper.configuration.access_token_methods)
unauthorized! unless token
scim_token = ScimOauthAccessToken.token_matches_for_group?(token, group)
unauthorized! unless scim_token
check_access_to_group!(group)
group
end
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment