MCPcopy Create free account
hub / github.com/BaseXdb/basex / authHeaders

Method authHeaders

basex-core/src/main/java/org/basex/util/http/Client.java:207–224  ·  view source on GitHub ↗

Returns the authentication headers. @param auth authorization string @return values values

(final String auth)

Source from the content-addressed store, hash-verified

205 * @return values values
206 */
207 public static EnumMap<RequestAttribute, String> authHeaders(final String auth) {
208 final EnumMap<RequestAttribute, String> values = new EnumMap<>(RequestAttribute.class);
209 if(auth != null) {
210 final String[] parts = Strings.split(auth, ' ', 2);
211 values.put(AUTH_METHOD, parts[0]);
212 if(parts.length > 1) {
213 for(final String header : Strings.split(parts[1], ',')) {
214 final String[] kv = Strings.split(header, '=', 2);
215 final String key = kv[0].trim();
216 if(!key.isEmpty() && kv.length == 2) {
217 final RequestAttribute r = Enums.get(RequestAttribute.class, key);
218 if(r != null) values.put(r, Strings.delete(kv[1], '"').trim());
219 }
220 }
221 }
222 }
223 return values;
224 }
225
226 /**
227 * Returns the payload.

Callers 2

loginMethod · 0.95
assignMethod · 0.95

Calls 6

splitMethod · 0.95
getMethod · 0.95
deleteMethod · 0.95
putMethod · 0.45
trimMethod · 0.45
isEmptyMethod · 0.45

Tested by

no test coverage detected