Feature: Login Status and User Authentication events

Open
#573 2 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
5/5
Estimated time
Over a week
Newbie friendliness
25/100
Issue type
Feature
Clarity
Mostly clear
Activity status
Stale
Tech stack
javascript
Domain
api

Research direction

Start by reading the specification sections for endpoints and notifications, then compare them with the existing /loginstatus endpoint mentioned in the issue. The proposal is complete when the specification defines how clients query authentication status and receive login/logout notifications, including the response fields and user groups.

Written by the indexing model from the issue text.

Description

Recent releases of the SignalK Node Server have introduced features that require a user to be authenticated before the feature can be used. Additionally some features are only available to admin users (e.g. applicationData/<appId>/<version>/global)

For client applications to provide a "trimmed" UI displaying the availability of these features it requires that the app be able to:

  • Query whether or not a user is authenticated to the server
  • Determine the type of user (or groups user is a member of)

Additionally an app needs to know whether there has been a change in the user authentication state e.g. login / logout.

Consider the following scenario:

  • SignalK server starts (no user authenticated)
  • Application is launched from WebApps section of the Server UI
  • User logs in to server using Server UI.

When the application starts no user is authenticated and if it performs a "login status" check it will return "no login", so app will trim UI to reflect this situation.

When the user authenticates using the server UI the app is unaware of the status change until it specifically performs another "login status" check.

The proposal:

Add the following to the specification so each client connection can query and be notified of login status.

  1. As SignalK node server already implements a /loginstatus endpoint, either formalise the current endpoint or define an appropriate endpoint and a response.
    The response should contain at a minimum the following:
{
   userAuthenticated: boolean
   userName: string,
   userGroups: Array<string>
}
  • userAuthenticated: true / false indicating a user is authenticated on the server
  • userName: name of the user authenticated on the server
  • userGroups: and array containing the names of the groups the authenticated user is a member of.
  1. Define an authentication notification that is triggered when a user logs in/out of the server that apps can subscribe to and respond to the changing authentication status.
    e.g.
{
   path: notifications.authentication,
   value: {
      userAuthenticated: boolean
      userName: string,
      userGroups: Array<string>
   }
}
Dominant language
JavaScript
Stars
105
Forks
72
Avg merge
11h 49m
Merged PRs (30d)
5

Getting set up

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from SignalK/specification

All issues in SignalK/specification

Similar issues

More JavaScript issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.