Skip to content

Implement authorization #498

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 11 commits into from
Jun 2, 2025
Merged

Implement authorization #498

merged 11 commits into from
Jun 2, 2025

Conversation

Shatur
Copy link
Contributor

@Shatur Shatur commented May 28, 2025

It superseds replicate_after_connect. By default we just verify compatibility between client and server, but it's customizable via RepliconSharedPlugin::auth_method.

@Shatur Shatur requested a review from UkoeHB May 28, 2025 19:57
It superseds `replicate_after_connect`. By default we just verify
compatibility between client and server, but it's customizable via
`RepliconSharedPlugin::auth_method`.

In the Tic-Tac-Toe example, I switched to deterministic sorting, which
is more efficient because I also used it in the doc example for
authorization.
Copy link

codecov bot commented May 28, 2025

Codecov Report

Attention: Patch coverage is 86.86869% with 13 lines in your changes missing coverage. Please review.

Project coverage is 82.24%. Comparing base (d199a1e) to head (dab2a46).
Report is 4 commits behind head on master.

Files with missing lines Patch % Lines
src/server.rs 70.83% 7 Missing ⚠️
src/shared/protocol.rs 89.47% 4 Missing ⚠️
src/shared/event/server_event.rs 60.00% 2 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           master     #498      +/-   ##
==========================================
+ Coverage   81.64%   82.24%   +0.59%     
==========================================
  Files          52       53       +1     
  Lines        3019     3104      +85     
==========================================
+ Hits         2465     2553      +88     
+ Misses        554      551       -3     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

Shatur added a commit to projectharmonia/bevy_replicon_renet that referenced this pull request May 31, 2025
- React on `DisconnectRequest` event.
  Relevant PR:
  projectharmonia/bevy_replicon#491
- Process received data on disconnect.
  Relevant PR:
  projectharmonia/bevy_replicon#494
- Update examples.
  Relevant PRs:
  projectharmonia/bevy_replicon#498
  projectharmonia/bevy_replicon#479
- Update tests.
  - Move server stopping into a separate test.
    Relevant PR:
    projectharmonia/bevy_replicon#494
  - Add `finish` calls. Required to initialize channels.
    Relevant PR:
    projectharmonia/bevy_replicon#488
  - Test `DisconnectRequest`.
    Relevant PR:
    projectharmonia/bevy_replicon#491
  - Remove uses of the word "Dummy".
    Relevant PR:
    projectharmonia/bevy_replicon#486
Shatur added a commit to projectharmonia/bevy_replicon_renet that referenced this pull request May 31, 2025
- React on `DisconnectRequest` event.
  Relevant PR:
  projectharmonia/bevy_replicon#491
- Process received data on disconnect.
  Relevant PR:
  projectharmonia/bevy_replicon#494
- Update examples.
  Relevant PRs:
  projectharmonia/bevy_replicon#498
  projectharmonia/bevy_replicon#479
- Update tests.
  - Move server stopping into a separate test.
    Relevant PR:
    projectharmonia/bevy_replicon#494
  - Add `finish` calls. Required to initialize channels.
    Relevant PR:
    projectharmonia/bevy_replicon#488
  - Test `DisconnectRequest`.
    Relevant PR:
    projectharmonia/bevy_replicon#491
  - Remove uses of the word "Dummy".
    Relevant PR:
    projectharmonia/bevy_replicon#486
src/server.rs Outdated
AuthMethod::ProtocolCheck => {
app.add_observer(check_protocol);
}
AuthMethod::Disabled => {
Copy link
Collaborator

Choose a reason for hiding this comment

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

Suggested change
AuthMethod::Disabled => {
AuthMethod::None => {

This is more semantically accurate. Setting the auth method doesn't 'disable' anything.

Comment on lines 440 to 442
self.world_mut()
.resource_mut::<ProtocolHasher>()
.add_replication_rule::<R>();
Copy link
Collaborator

Choose a reason for hiding this comment

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

Should include priority.

@Shatur Shatur requested a review from UkoeHB June 2, 2025 18:49
@Shatur Shatur merged commit 091192a into master Jun 2, 2025
8 checks passed
@Shatur Shatur deleted the authorization branch June 2, 2025 22:53
Shatur added a commit to projectharmonia/bevy_replicon_renet that referenced this pull request Jun 2, 2025
- React on `DisconnectRequest` event.
  Relevant PR:
  projectharmonia/bevy_replicon#491
- Process received data on disconnect.
  Relevant PR:
  projectharmonia/bevy_replicon#494
- Update examples.
  Relevant PRs:
  projectharmonia/bevy_replicon#498
  projectharmonia/bevy_replicon#479
- Update tests.
  - Move server stopping into a separate test.
    Relevant PR:
    projectharmonia/bevy_replicon#494
  - Add `finish` calls. Required to initialize channels.
    Relevant PR:
    projectharmonia/bevy_replicon#488
  - Test `DisconnectRequest`.
    Relevant PR:
    projectharmonia/bevy_replicon#491
  - Remove uses of the word "Dummy".
    Relevant PR:
    projectharmonia/bevy_replicon#486
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Send the hash of the defined protocol Allow out-of-order event registration
2 participants