Skip to content

Conversation

@aqrln
Copy link
Member

@aqrln aqrln commented Feb 6, 2017

  • Introduce the concept of authentication strategies.
  • Implement login and anonymous strategies.
  • Make handshake packets include the strategy as an action field.
  • Update tests.
  • Update docs.

Refs: #35 (comment)

See more details about the implementation in the updated doc/protocol.md.

};

// Callback of authentication operation
// username - user login, if any
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You can probably change order of arguments here as well, to correspond with function signature.

// password - null (required by the auth callback contract)
// strategy - authentication strategy (only 'anonymous' is supported)
// credentials - authentication credentials
// callback - callback function that has signature (error, sessionId)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Callback signature here does not correspond to the callback you are calling on line 33.

connection, application,
strategy, credentials, callback
) => {
console.dir({ strategy, credentials });
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Was it intentionally left here?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Leftover of fixing tests. Thanks for noticing it.

doc/protocol.md Outdated
There are two supported strategies now:

* `login` — authentication with login and password. The payload is an array of
two elements: user name and password, both represented as strings.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In this case it is usually more appropriate to write "username", not "user name".

@aqrln aqrln force-pushed the new-handshake-format branch from b87f0c6 to 8e32661 Compare February 6, 2017 16:55
@aqrln
Copy link
Member Author

aqrln commented Feb 6, 2017

@belochub updated to resolve the issues and nits.

Copy link
Member

@belochub belochub left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

* Introduce the concept of authentication strategies.
* Implement `login` and `anonymous` strategies.
* Make handshake packets include the strategy as an action field.
* Update tests.
* Update docs.

Refs: #35 (comment)
@aqrln aqrln force-pushed the new-handshake-format branch from 8e32661 to 45e6696 Compare February 6, 2017 18:32
@aqrln
Copy link
Member Author

aqrln commented Feb 6, 2017

Rebased to resolve conflicts.

@aqrln
Copy link
Member Author

aqrln commented Feb 6, 2017

@tshemsedinov awaiting your review.

Copy link
Member

@tshemsedinov tshemsedinov left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@aqrln @belochub You can merge this changes but if you will do so, we will not use new JSTP for current projects. SO if there any opportunity to be backward compatible please do that. I'll hold that in mind and will try to change strategy to break compatibility this time.

@aqrln
Copy link
Member Author

aqrln commented Feb 6, 2017

@tshemsedinov it's semver-major anyway, so it will go along with any other breaking changes. All non-breaking changes are still being landed on v0.6 too.

@aqrln
Copy link
Member Author

aqrln commented Feb 6, 2017

@tshemsedinov and it is still possible to do a protocol-level compatibility fixup for v0.6 granted we have no users named 'login', 'anonymous' or 'session' :)
Whom we actually don't even if someone used such nicknames since the protocol-level authentication is not used in the current projects and all users are anonymous from the point of view of JSTP.

@aqrln
Copy link
Member Author

aqrln commented Feb 6, 2017

@tshemsedinov @belochub it has just occurred to me that in fact the protocol-level compatibility will not be broken for our applications because of the reasons I told in the previous comment. Since only anonymous handshakes were used and authentication was performed using RPC methods, and anonymous handshakes syntax has not changed, we can update the server to JSTP 0.7 without updating the clients.

@aqrln
Copy link
Member Author

aqrln commented Feb 6, 2017

@tshemsedinov @belochub so basically we don't even need backporting this PR to v0.6 and supporting v0.6 at all.

@aqrln
Copy link
Member Author

aqrln commented Feb 6, 2017

If we introduce any new breaking changes that will not be feasible to work around, we'll release v0.7 in its current state, call new breaking changes v0.8 and continue landing non-breaking changes to v0.7.

aqrln added a commit that referenced this pull request Feb 6, 2017
* Introduce the concept of authentication strategies.
* Implement `login` and `anonymous` strategies.
* Make handshake packets include the strategy as an action field.
* Update tests.
* Update docs.

Refs: #35 (comment)
PR-URL: #54
@aqrln
Copy link
Member Author

aqrln commented Feb 6, 2017

Landed in 9e55d3c.

@aqrln aqrln closed this Feb 6, 2017
@aqrln aqrln deleted the new-handshake-format branch February 6, 2017 22:41
belochub pushed a commit that referenced this pull request Jan 22, 2018
* Introduce the concept of authentication strategies.
* Implement `login` and `anonymous` strategies.
* Make handshake packets include the strategy as an action field.
* Update tests.
* Update docs.

Refs: #35 (comment)
PR-URL: #54
belochub pushed a commit that referenced this pull request Jan 22, 2018
* Introduce the concept of authentication strategies.
* Implement `login` and `anonymous` strategies.
* Make handshake packets include the strategy as an action field.
* Update tests.
* Update docs.

Refs: #35 (comment)
PR-URL: #54
belochub added a commit that referenced this pull request Jan 22, 2018
This is a new and shiny first major release for `metarhia-jstp`.
Changes include API refactoring and improvements, implementations of
CLI, sessions, and application versions, native addon build optimizations,
lots of bug fixes, test coverage increase, and other, less notable changes.

This release also denotes the bump of the protocol version to v1.0.
The only difference from the previous version of the protocol is that
"old" heartbeat messages (`{}`) are now deprecated and `ping`/`pong`
messages must be used for this purpose instead.

Notable changes:

 * **src,build:** improve the native module subsystem
   *(Alexey Orlenko)*
   [#36](#36)
   **\[semver-minor\]**
 * **build:** compile in ISO C++11 mode
   *(Alexey Orlenko)*
   [#37](#37)
   **\[semver-minor\]**
 * **build:** improve error handling
   *(Alexey Orlenko)*
   [#40](#40)
   **\[semver-minor\]**
 * **lib:** refactor record-serialization.js
   *(Alexey Orlenko)*
   [#41](#41)
   **\[semver-minor\]**
 * **protocol:** change the format of handshake packets
   *(Alexey Orlenko)*
   [#54](#54)
   **\[semver-major\]**
 * **parser:** remove special case for '\0' literal
   *(Mykola Bilochub)*
   [#68](#68)
   **\[semver-major\]**
 * **client:** drop redundant callback argument
   *(Alexey Orlenko)*
   [#104](#104)
   **\[semver-major\]**
 * **client:** handle errors in connectAndInspect
   *(Alexey Orlenko)*
   [#105](#105)
   **\[semver-major\]**
 * **socket,ws:** use socket.destroy() properly
   *(Alexey Orlenko)*
   [#84](#84)
   **\[semver-major\]**
 * **cli:** add basic implementation
   *(Mykola Bilochub)*
   [#107](#107)
   **\[semver-minor\]**
 * **connection:** fix error handling in optional cbs
   *(Alexey Orlenko)*
   [#147](#147)
   **\[semver-major\]**
 * **lib:** change event signature
   *(Denys Otrishko)*
   [#187](#187)
   **\[semver-major\]**
 * **lib:** add address method to Server
   *(Denys Otrishko)*
   [#190](#190)
   **\[semver-minor\]**
 * **lib:** optimize connection events
   *(Denys Otrishko)*
   [#222](#222)
   **\[semver-major\]**
 * **lib:** refactor server and client API
   *(Denys Otrishko)*
   [#209](#209)
   **\[semver-major\]**
 * **lib,src:** rename term packet usages to message
   *(Denys Otrishko)*
   [#270](#270)
   **\[semver-major\]**
 * **lib:** emit events about connection messages
   *(Denys Otrishko)*
   [#252](#252)
   **\[semver-minor\]**
 * **connection:** make callback method private
   *(Alexey Orlenko)*
   [#306](#306)
   **\[semver-major\]**
 * **lib:** implement sessions
   *(Mykola Bilochub)*
   [#289](#289)
   **\[semver-major\]**
 * **connection:** use ping-pong instead of heartbeat
   *(Dmytro Nechai)*
   [#303](#303)
   **\[semver-major\]**
@belochub belochub mentioned this pull request Jan 22, 2018
belochub added a commit that referenced this pull request Jan 23, 2018
This is a new and shiny first major release for `metarhia-jstp`.
Changes include API refactoring and improvements, implementations of
CLI, sessions, and application versions, native addon build optimizations,
lots of bug fixes, test coverage increase, and other, less notable changes.

This release also denotes the bump of the protocol version to v1.0.
The only difference from the previous version of the protocol is that
"old" heartbeat messages (`{}`) are now deprecated and `ping`/`pong`
messages must be used for this purpose instead.

Notable changes:

 * **src,build:** improve the native module subsystem
   *(Alexey Orlenko)*
   [#36](#36)
   **\[semver-minor\]**
 * **build:** compile in ISO C++11 mode
   *(Alexey Orlenko)*
   [#37](#37)
   **\[semver-minor\]**
 * **build:** improve error handling
   *(Alexey Orlenko)*
   [#40](#40)
   **\[semver-minor\]**
 * **lib:** refactor record-serialization.js
   *(Alexey Orlenko)*
   [#41](#41)
 * **parser:** fix a possible memory leak
   *(Alexey Orlenko)*
   [#44](#44)
   **\[semver-minor\]**
 * **protocol:** change the format of handshake packets
   *(Alexey Orlenko)*
   [#54](#54)
   **\[semver-major\]**
 * **parser:** make parser single-pass
   *(Mykola Bilochub)*
   [#61](#61)
 * **parser:** remove special case for '\0' literal
   *(Mykola Bilochub)*
   [#68](#68)
   **\[semver-major\]**
 * **parser:** fix bug causing node to crash
   *(Mykola Bilochub)*
   [#75](#75)
 * **client:** drop redundant callback argument
   *(Alexey Orlenko)*
   [#104](#104)
   **\[semver-major\]**
 * **client:** handle errors in connectAndInspect
   *(Alexey Orlenko)*
   [#105](#105)
   **\[semver-major\]**
 * **socket,ws:** use socket.destroy() properly
   *(Alexey Orlenko)*
   [#84](#84)
   **\[semver-major\]**
 * **cli:** add basic implementation
   *(Mykola Bilochub)*
   [#107](#107)
   **\[semver-minor\]**
 * **connection:** fix error handling in optional cbs
   *(Alexey Orlenko)*
   [#147](#147)
   **\[semver-major\]**
 * **test:** add JSON5 specs test suite
   *(Alexey Orlenko)*
   [#158](#158)
 * **lib:** change event signature
   *(Denys Otrishko)*
   [#187](#187)
   **\[semver-major\]**
 * **lib:** add address method to Server
   *(Denys Otrishko)*
   [#190](#190)
   **\[semver-minor\]**
 * **parser:** implement NaN and Infinity parsing
   *(Mykola Bilochub)*
   [#201](#201)
 * **parser:** improve string parsing performance
   *(Mykola Bilochub)*
   [#220](#220)
 * **lib:** optimize connection events
   *(Denys Otrishko)*
   [#222](#222)
   **\[semver-major\]**
 * **lib:** refactor server and client API
   *(Denys Otrishko)*
   [#209](#209)
   **\[semver-major\]**
 * **lib,src:** rename term packet usages to message
   *(Denys Otrishko)*
   [#270](#270)
   **\[semver-major\]**
 * **lib:** emit events about connection messages
   *(Denys Otrishko)*
   [#252](#252)
   **\[semver-minor\]**
 * **lib:** implement API versioning
   *(Denys Otrishko)*
   [#231](#231)
   **\[semver-minor\]**
 * **lib:** allow to set event handlers in application
   *(Denys Otrishko)*
   [#286](#286)
   **\[semver-minor\]**
 * **lib:** allow to broadcast events from server
   *(Denys Otrishko)*
   [#287](#287)
   **\[semver-minor\]**
 * **connection:** make callback method private
   *(Alexey Orlenko)*
   [#306](#306)
   **\[semver-major\]**
 * **lib:** implement sessions
   *(Mykola Bilochub)*
   [#289](#289)
   **\[semver-major\]**
 * **connection:** use ping-pong instead of heartbeat
   *(Dmytro Nechai)*
   [#303](#303)
   **\[semver-major\]**
belochub pushed a commit to metarhia/mdsf that referenced this pull request Jul 19, 2018
* Introduce the concept of authentication strategies.
* Implement `login` and `anonymous` strategies.
* Make handshake packets include the strategy as an action field.
* Update tests.
* Update docs.

Refs: metarhia/jstp#35 (comment)
PR-URL: metarhia/jstp#54
belochub pushed a commit to metarhia/mdsf that referenced this pull request Jul 19, 2018
* Introduce the concept of authentication strategies.
* Implement `login` and `anonymous` strategies.
* Make handshake packets include the strategy as an action field.
* Update tests.
* Update docs.

Refs: metarhia/jstp#35 (comment)
PR-URL: metarhia/jstp#54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants