Skip to content
This repository has been archived by the owner on Dec 15, 2022. It is now read-only.

Authentication #18

Merged
merged 36 commits into from
Sep 29, 2017
Merged

Authentication #18

merged 36 commits into from
Sep 29, 2017

Conversation

as-cii
Copy link
Contributor

@as-cii as-cii commented Sep 27, 2017

Supplants and closes #8
Depends on atom/teletype-server#20

This pull-request adds support for authentication, allowing to determine the identity of a given site or peer. As part of this, the vocabulary has been modified to better reflect the distinction between peer-level, network-level and portal-level concepts (see b02feb8 for more details).

Please, note that this introduces a breaking change in the protocol. As such, we have bumped the protocol version in d927d98 to prevent people with different versions of the package to collaborate with each other.

/cc: @nathansobo @jasonrudolph

Nathan Sobo and others added 26 commits September 25, 2017 15:37
This helps differentiate the more abstract concept of "joining" or
"leaving" the network from the more concrete concept of a direct
connection to another peer.
Instead of forwarding the join request to spokes, we'll send an explicit
notification message
The local peer's identity is fetched on initialization via the
`authenticate` method. Other peer identities are expected to be relayed
by the server on the first signal.
We could encounter invalid token errors for a variety of reasons, such
as the user pasting garbage or the user explicitly deleting their auth
token on github.com. When this happens, we want to prompt the user for a
new token. This means the token isn't a constant, and injecting it
directly into various layers of the system is problematic when it comes
time to update it. Injecting a *provider*, which *is* constant, makes
updating the token as trivial as telling the provider to clear its cache
when we hit invalid token errors and requesting a new token.

/cc @jasonrudolph
We still need to cover 401 responses during signaling.
We handle invalid tokens when offering by rejecting the connected
promise with the invalid token error.

We handle invalid token errors when answering by disconnecting and
dispatching onError listeners with the error, since there's no relevant
calling code on the stack when we receive a signal and answer.

In both cases, we tell the auth token provider to forget its token.
...becasue `hostDidLoseConnection` or `hostDidClosePortal` will be
called instead.
@as-cii as-cii merged commit af4a5fb into master Sep 29, 2017
@as-cii as-cii deleted the authentication-2 branch September 29, 2017 10:27
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants