MCPcopy Create free account
hub / github.com/saltstack/salt / __auth_call

Method __auth_call

salt/auth/__init__.py:115–142  ·  view source on GitHub ↗

Return the token and set the cache data for use Do not call this directly! Use the time_auth method to overcome timing attacks

(self, load)

Source from the content-addressed store, hash-verified

113 return ""
114
115 def __auth_call(self, load):
116 """
117 Return the token and set the cache data for use
118
119 Do not call this directly! Use the time_auth method to overcome timing
120 attacks
121 """
122 if "eauth" not in load:
123 return False
124 fstr = "{}.auth".format(load["eauth"])
125 if fstr not in self.auth:
126 return False
127 # When making auth calls, only username, password, auth, and token
128 # are valid, so we strip anything else out.
129 _valid = ["username", "password", "eauth", "token"]
130 _load = {key: value for (key, value) in load.items() if key in _valid}
131
132 fcall = salt.utils.args.format_call(
133 self.auth[fstr], _load, expected_extra_kws=AUTH_INTERNAL_KEYWORDS
134 )
135 try:
136 if "kwargs" in fcall:
137 return self.auth[fstr](*fcall["args"], **fcall["kwargs"])
138 else:
139 return self.auth[fstr](*fcall["args"])
140 except Exception as e: # pylint: disable=broad-except
141 log.debug("Authentication module threw %s", e)
142 return False
143
144 def time_auth(self, load):
145 """

Callers 1

time_authMethod · 0.95

Calls 3

formatMethod · 0.80
debugMethod · 0.80
itemsMethod · 0.45

Tested by

no test coverage detected