Run the ClientΒΆ

Login as the admin user, and you should see the admin has roles admin and user.

Note that the username / passwords are read from the file userdatabase.txt in the root of the project directory. You can use the users in that file for testing.

Note that sometimes the CLI loses the cursor and output after running the client. Your best option is to start a new terminal tab.

$  sbt chatclient/run
...
-> /login admin
[run-main-0] INFO ChatClient - processing login user
password> *****
[run-main-0] INFO chatroom.ChannelManager - authenticating user: admin
[run-main-0] INFO chatroom.ChannelManager - user has these roles: Vector(admin, user)
[run-main-0] INFO chatroom.ChannelManager - initializing chat services with token: eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJzdWIiOiJhZG1pbiIsImlzcyI6ImF1dGgtaXNzdWVyIn0.oQebRc48QIig1R5-JajeTCP3TWP1fThBilNpoOtKavA
readLogin new state: CurrentState(AUTHENTICATED,admin,eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJzdWIiOiJhZG1pbiIsImlzcyI6ImF1dGgtaXNzdWVyIn0.oQebRc48QIig1R5-JajeTCP3TWP1fThBilNpoOtKavA,null)
STATE: CurrentState(AUTHENTICATED,admin,eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJzdWIiOiJhZG1pbiIsImlzcyI6ImF1dGgtaXNzdWVyIn0.oQebRc48QIig1R5-JajeTCP3TWP1fThBilNpoOtKavA,null)
[run-main-0] INFO ChatClient - [chat message] | /join [room] | /leave [room] | /create [room] | /list | /quit
-> /quit

Login with an invalid credential, and you should see a StatusRuntimeException with Status.UNAUTHENTICATED error:

$ sbt chatclient/run
...
-> /login kevin
[run-main-0] INFO ChatClient - processing login user
password> asdf
[run-main-0] INFO chatroom.ChannelManager - authenticating user: bla
[run-main-0] ERROR chatroom.ChannelManager - user not authenticated: bla
io.grpc.StatusRuntimeException: UNAUTHENTICATED
-> /quit