Skip to content

Commit 660965b

Browse files
author
kaleidox
committed
add ofHeader() method
1 parent 4003429 commit 660965b

1 file changed

Lines changed: 7 additions & 0 deletions

File tree

src/main/java/org/comroid/api/model/Authentication.java

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,13 @@ public static Authentication ofToken(final @NotNull String username, final @NotN
3636
return new Authentication(Type.UsernameToken, username, token);
3737
}
3838

39+
public static Authentication ofHeader(String headerValue) {
40+
var value = Base64.decode(headerValue);
41+
var split = value.split(":");
42+
43+
return ofLogin(split[0], split[1]);
44+
}
45+
3946
@Default Type type = Type.Anonymous;
4047
@Default @Nullable String username = null;
4148
@Default @Nullable String passkey = null;

0 commit comments

Comments
 (0)