X-Git-Url: https://git.arvados.org/arvados.git/blobdiff_plain/59442e10fbf012ffec80c0a178778c3698ff4789..0110ce93702def9a641d92d90d5544d4d0adf22b:/services/api/app/models/api_client_authorization.rb diff --git a/services/api/app/models/api_client_authorization.rb b/services/api/app/models/api_client_authorization.rb index 3afbd3b3e7..651eacf626 100644 --- a/services/api/app/models/api_client_authorization.rb +++ b/services/api/app/models/api_client_authorization.rb @@ -108,10 +108,25 @@ class ApiClientAuthorization < ArvadosModel clnt end + def self.check_system_root_token token + if token == Rails.configuration.SystemRootToken + return ApiClientAuthorization.new(user: User.find_by_uuid(system_user_uuid), + api_token: token, + api_client: ApiClient.new(is_trusted: true, url_prefix: "")) + else + return nil + end + end + def self.validate(token:, remote: nil) - return nil if !token + return nil if token.nil? or token.empty? remote ||= Rails.configuration.ClusterID + auth = self.check_system_root_token(token) + if !auth.nil? + return auth + end + case token[0..2] when 'v2/' _, token_uuid, secret, optional = token.split('/')