File tree Expand file tree Collapse file tree 1 file changed +9
-2
lines changed
src/main/java/io/github/hapjava/server/impl/pairing Expand file tree Collapse file tree 1 file changed +9
-2
lines changed Original file line number Diff line number Diff line change @@ -42,6 +42,8 @@ public HttpResponse handle(HttpRequest request) throws IOException {
4242 Collection <String > usernames = authInfo .listUsers ();
4343 boolean first = true ;
4444 Iterator <String > iterator = usernames .iterator ();
45+ String mac = authInfo .getMac ();
46+
4547 while (iterator .hasNext ()) {
4648 String username = iterator .next ();
4749 if (first ) {
@@ -50,9 +52,14 @@ public HttpResponse handle(HttpRequest request) throws IOException {
5052 } else {
5153 e .add (MessageType .SEPARATOR );
5254 }
55+ byte [] publicKey = authInfo .getUserPublicKey (username );
56+ boolean isAdmin = authInfo .userIsAdmin (username );
57+ if (username .startsWith (mac )) {
58+ username = username .substring (mac .length ());
59+ }
5360 e .add (MessageType .USERNAME , username );
54- e .add (MessageType .PUBLIC_KEY , authInfo . getUserPublicKey ( username ) );
55- e .add (MessageType .PERMISSIONS , (short ) (authInfo . userIsAdmin ( username ) ? 1 : 0 ));
61+ e .add (MessageType .PUBLIC_KEY , publicKey );
62+ e .add (MessageType .PERMISSIONS , (short ) (isAdmin ? 1 : 0 ));
5663 }
5764 ;
5865
You can’t perform that action at this time.
0 commit comments