Skip to content
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

GUACAMOLE-1949 Nextcloud JWT Auth extension #984

Open
wants to merge 43 commits into
base: main
Choose a base branch
from
Open

Conversation

pp7En
Copy link

@pp7En pp7En commented May 5, 2024

Hi all,

I have built a small extension for myself and would like to share it with you. Maybe this is a function that would go well with Guacamole.

I use a self-hosted Nextcloud and the plugin “External Sites”. This plugin offers the possibility to send a JWT to an embedded website. This JWT is (Nextcloud) user-related and always valid for 1 minute. If the JWT is missing or has expired, an excpetion will be thrown. The extension validates the JWT and if it is valid, the Guacamole login screen is displayed. Everything else then proceeds as usual. Additionally, I have implemented that only certain Nextcloud users are allowed this access, independent of a valid JWT.

I have decided to not make the login screen accessible worldwide, that's why an exception will be thrown if anyone call the guacamole client directly (https://example.com/guacamole) and a login is only possible within the Nextcloud (https://cloud.example.com/).

Another small additional use case in my environment: The login screen should still be displayed for a few clients (via IP addresses), so the IP address will be checked and validated.

Jira Ticket GUACAMOLE-1949

Copy link
Contributor

@necouchman necouchman left a comment

Choose a reason for hiding this comment

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

A few more changes from me - at this point mostly style and documentation.

Also, your pull request and commit messages are formatted slightly incorrectly - should be:
GUACAMOLE-1949: Nextcloud JWT authentication extension
with a ":" between the Jira issue and the comment.

@pp7En pp7En requested a review from necouchman June 1, 2024 15:51
Copy link
Contributor

@necouchman necouchman left a comment

Choose a reason for hiding this comment

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

A few more things to tweak - it's getting very close :-).

In general, make sure you're following established style guidelines within the code. In particular:

  • Don't cuddle braces for both if...else and try...catch statements.
  • Make sure your JavaDoc comments are properly spaced.

}
}

private boolean validIpAddress(final String ipAddress) throws GuacamoleException {
Copy link
Contributor

Choose a reason for hiding this comment

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

Please put empty lines between @param, @return, and @throws.

@pp7En
Copy link
Author

pp7En commented Jun 9, 2024

Thank you for your patience. I've cleaned up a bit and hope it doesn't look any worse as a result 😁

@pp7En pp7En requested a review from necouchman June 15, 2024 08:20
Copy link
Contributor

@necouchman necouchman left a comment

Choose a reason for hiding this comment

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

A few more changes - getting close. As mentioned in one of the comments below, I am wondering why this doesn't go ahead and authenticate the user to Guacamole? Is there some reason you wouldn't want users to be automatically logged in?

@pp7En
Copy link
Author

pp7En commented Jun 19, 2024

I've added a README.md to explain the configuration.

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.

3 participants