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

Site account extensions #2008

Merged
merged 63 commits into from
Aug 20, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
63 commits
Select commit Hold shift + click to select a range
fa71253
Add Dockerfile.old
Daniel-WWU-IT Jun 30, 2021
2012843
Restructure endpoint handling
Daniel-WWU-IT Jun 30, 2021
68639b0
Add some more fields to user accounts
Daniel-WWU-IT Jun 30, 2021
a9f422b
Add user passwords
Daniel-WWU-IT Jul 1, 2021
42ed780
Minor corrections
Daniel-WWU-IT Jul 2, 2021
b3fe4e1
Rename panel to admin
Daniel-WWU-IT Jul 2, 2021
cf8b597
Use bcrypt for storing passwords
Daniel-WWU-IT Jul 2, 2021
54b5258
Implement an HTML panel engine
Daniel-WWU-IT Jul 5, 2021
6abccff
Add user role to accounts
Daniel-WWU-IT Jul 5, 2021
e5a9f2e
Move endpoint /register to /account
Daniel-WWU-IT Jul 5, 2021
951bfe5
Add session management
Daniel-WWU-IT Jul 6, 2021
9836a6c
Support multiple templates per panel
Daniel-WWU-IT Jul 6, 2021
4174708
Add login form (WIP)
Daniel-WWU-IT Jul 7, 2021
6f89beb
Add user authentication endpoint
Daniel-WWU-IT Jul 7, 2021
a94675f
Restructure session management and support login
Daniel-WWU-IT Jul 8, 2021
5f556a3
Implement user login
Daniel-WWU-IT Jul 8, 2021
b7b8709
Work on user management template
Daniel-WWU-IT Jul 9, 2021
9768156
Add account editing
Daniel-WWU-IT Jul 12, 2021
94a4f6b
Improve session handling
Daniel-WWU-IT Jul 12, 2021
9a3b182
Enable password reset
Daniel-WWU-IT Jul 13, 2021
ed4d952
Fix storing of logged in account
Daniel-WWU-IT Jul 13, 2021
bc99b76
Merge branch 'master-upstream' into siteacc-ext
Daniel-WWU-IT Jul 13, 2021
fd81812
Remove debug output
Daniel-WWU-IT Jul 13, 2021
8c5d9c1
Fix password reset form
Daniel-WWU-IT Jul 13, 2021
035d773
Add GOCDB access flag to accounts
Daniel-WWU-IT Jul 14, 2021
f6efa98
Verify account website and phone number
Daniel-WWU-IT Jul 14, 2021
35133a5
Session handling improvements
Daniel-WWU-IT Jul 16, 2021
27516be
Session handling improvements
Daniel-WWU-IT Jul 16, 2021
f5e7a74
Debugging
Daniel-WWU-IT Jul 16, 2021
efb469e
Debugging
Daniel-WWU-IT Jul 16, 2021
a64215d
Fix URI path handling
Daniel-WWU-IT Jul 16, 2021
e1fdfb0
Fixes
Daniel-WWU-IT Jul 16, 2021
3f38706
Edit account template improvements
Daniel-WWU-IT Jul 16, 2021
6873199
Add user tokens for external authentication
Daniel-WWU-IT Jul 19, 2021
02538da
User token refreshing
Daniel-WWU-IT Jul 20, 2021
b70dc83
Add scope check to login
Daniel-WWU-IT Jul 20, 2021
a3c6e75
Make verify-user-token a GET endpoint
Daniel-WWU-IT Jul 21, 2021
0c3ebb4
Switch to JWT for user tokens
Daniel-WWU-IT Jul 22, 2021
e942d45
Form improvements
Daniel-WWU-IT Jul 23, 2021
189de96
Merge branch 'master-upstream' into siteacc-ext
Daniel-WWU-IT Jul 26, 2021
aaabc72
Email updates
Daniel-WWU-IT Jul 26, 2021
2a4467f
Add request form
Daniel-WWU-IT Jul 27, 2021
9f2d0f6
Trim form entries
Daniel-WWU-IT Jul 28, 2021
8f9b955
JS updates
Daniel-WWU-IT Jul 29, 2021
ff892a4
Make all URLs absolute
Daniel-WWU-IT Jul 29, 2021
1904a27
General improvements
Daniel-WWU-IT Jul 29, 2021
6a71f76
Typo
Daniel-WWU-IT Jul 29, 2021
c742eb7
Fix cookie settings
Daniel-WWU-IT Jul 29, 2021
f5c4819
Form improvements
Daniel-WWU-IT Aug 2, 2021
66b146b
Hash password on client side
Daniel-WWU-IT Aug 2, 2021
97d9e99
Hash password on client side
Daniel-WWU-IT Aug 2, 2021
72d8925
Revert "Hash password on client side"
Daniel-WWU-IT Aug 2, 2021
f276644
Revert "Hash password on client side"
Daniel-WWU-IT Aug 2, 2021
cb9219c
Form improvements
Daniel-WWU-IT Aug 2, 2021
0e229e6
Small form improvements
Daniel-WWU-IT Aug 3, 2021
5838fd0
Add title to accounts
Daniel-WWU-IT Aug 11, 2021
719c756
Add synchronization with GOCDB
Daniel-WWU-IT Aug 16, 2021
e22f3ed
Merge branch 'master-upstream' into siteacc-ext
Daniel-WWU-IT Aug 19, 2021
6c010bb
Use official JWT package
Daniel-WWU-IT Aug 19, 2021
05cc442
Add changelog
Daniel-WWU-IT Aug 19, 2021
b001930
Hound fixes
Daniel-WWU-IT Aug 19, 2021
9163342
Lint fixes
Daniel-WWU-IT Aug 19, 2021
2668213
Hound fixes
Daniel-WWU-IT Aug 19, 2021
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions changelog/unreleased/siteacc-ext.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
Enhancement: Site account extensions

This PR heavily extends the site accounts service:
* Extended the accounts information (not just email and name)
* Accounts now have a password
* Users can now "log in" to their accounts and edit it
* Ability to grant access to the GOCDB

Furthermore, these accounts can now be used to authenticate for logging in to our customized GOCDB. More use cases for these accounts are also planned.

https://github.com/cs3org/reva/pull/2008
74 changes: 62 additions & 12 deletions docs/content/en/docs/config/http/services/siteacc/_index.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,68 +19,85 @@ prefix = "/siteacc"
{{< /highlight >}}
{{% /dir %}}

{{% dir name="enable_registration_form" type="string" default="false" %}}
If set to true, the service will expose a simple form for account registration.
## GOCDB settings
{{% dir name="url" type="string" default="" %}}
The external URL of the central GOCDB instance.
{{< highlight toml >}}
[http.services.siteacc.gocdb]
url = "https://www.sciencemesh.eu/gocdb/"
{{< /highlight >}}
{{% /dir %}}

{{% dir name="write_url" type="string" default="" %}}
The external URL of the GOCDB Write API.
{{< highlight toml >}}
[http.services.siteacc]
enable_registration_form = true
[http.services.siteacc.gocdb]
write_url = "https://www.sciencemesh.eu/gocdbpi/"
{{< /highlight >}}
{{% /dir %}}

{{% dir name="apikey" type="string" default="" %}}
The API key for the GOCDB.
{{< highlight toml >}}
[http.services.siteacc.gocdb]
apikey = "verysecret"
{{< /highlight >}}
{{% /dir %}}

## Email settings
{{% dir name="notifications_mail" type="string" default="" %}}
An email address where all notifications are sent to.
{{< highlight toml >}}
[http.services.siteacc]
[http.services.siteacc.email]
notifications_mail = "notify@example.com"
{{< /highlight >}}
{{% /dir %}}

## SMTP settings
### SMTP settings
{{% dir name="sender_mail" type="string" default="" %}}
An email address from which all emails are sent.
{{< highlight toml >}}
[http.services.siteacc.smtp]
[http.services.siteacc.email.smtp]
sender_mail = "notify@example.com"
{{< /highlight >}}
{{% /dir %}}

{{% dir name="sender_login" type="string" default="" %}}
The login name.
{{< highlight toml >}}
[http.services.siteacc.smtp]
[http.services.siteacc.email.smtp]
sender_login = "hans"
{{< /highlight >}}
{{% /dir %}}

{{% dir name="sender_password" type="string" default="" %}}
The password for the login.
{{< highlight toml >}}
[http.services.siteacc.smtp]
[http.services.siteacc.email.smtp]
password = "secret"
{{< /highlight >}}
{{% /dir %}}

{{% dir name="smtp_server" type="string" default="" %}}
The SMTP server to use.
{{< highlight toml >}}
[http.services.siteacc.smtp]
[http.services.siteacc.email.smtp]
smtp_server = "smtp.example.com"
{{< /highlight >}}
{{% /dir %}}

{{% dir name="smtp_port" type="int" default="25" %}}
The SMTP server port to use.
{{< highlight toml >}}
[http.services.siteacc.smtp]
[http.services.siteacc.email.smtp]
smtp_port = 25
{{< /highlight >}}
{{% /dir %}}

{{% dir name="disable_auth" type="bool" default="false" %}}
Whether to disable authentication.
{{< highlight toml >}}
[http.services.siteacc.smtp]
[http.services.siteacc.email.smtp]
disable_auth = true
{{< /highlight >}}
{{% /dir %}}
Expand Down Expand Up @@ -111,3 +128,36 @@ The registration service URL.
url = "https://iop.example.com/sitereg"
{{< /highlight >}}
{{% /dir %}}

## Webserver settings
{{% dir name="url" type="string" default="" %}}
The external URL of the site accounts service.
{{< highlight toml >}}
[http.services.siteacc.webserver]
url = "https://www.sciencemesh.eu/accounts/"
{{< /highlight >}}
{{% /dir %}}

{{% dir name="session_timeout" type="int" default="300" %}}
The session timeout in seconds.
{{< highlight toml >}}
[http.services.siteacc.webserver]
session_timeout = 600
{{< /highlight >}}
{{% /dir %}}

{{% dir name="verify_remote_address" type="bool" default="false" %}}
If true, sessions are only valid if they belong to the same IP. This can cause problems behind proxy servers.
{{< highlight toml >}}
[http.services.siteacc.webserver]
verify_remote_address = true
{{< /highlight >}}
{{% /dir %}}

{{% dir name="log_sessions" type="bool" default="false" %}}
If enabled, debug information about sessions will be printed.
{{< highlight toml >}}
[http.services.siteacc.webserver]
log_sessions = true
{{< /highlight >}}
{{% /dir %}}
20 changes: 14 additions & 6 deletions examples/siteacc/siteacc.toml
Original file line number Diff line number Diff line change
@@ -1,21 +1,29 @@
[http]
address = "0.0.0.0:9600"

[http.services.siteacc]
# If this is set to true, the service will expose a simple form for account registration
enable_registration_form = true
# All notification emails are sent to this email
notifications_mail = "science.mesh@example.com"
[http.services.siteacc.gocdb]
url = "https://sciencemesh-test.uni-muenster.de/gocdb/"
write_url = "https://sciencemesh-test.uni-muenster.de/gocdbpi/"
apikey = "verysecret"

# Set up the storage driver
[http.services.siteacc.storage]
driver = "file"
[http.services.siteacc.storage.file]
file = "/var/revad/accounts.json"

# Email related settings
[http.services.siteacc.email]
notifications_mail = "science.mesh@example.com"

# The SMTP server used for sending emails
[http.services.siteacc.smtp]
[http.services.siteacc.email.smtp]
sender_mail = "science.mesh@example.com"
smtp_server = "mail.example.com"
smtp_port = 25
disable_auth = true

# The webserver section defines various webserver-related settings
[http.services.siteacc.webserver]
url = "https://sciencemesh-test.uni-muenster.de/api/accounts/"
session_timeout = 60
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ func parseConfig(m map[string]interface{}) (*config, error) {
return c, nil
}

// New creates a new Public Storage Provider service.
// New creates a new IsPublic Storage Provider service.
func New(m map[string]interface{}, ss *grpc.Server) (rgrpc.Service, error) {
c, err := parseConfig(m)
if err != nil {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,7 @@ func (h *Handler) Init(c *config.Config) {
h.c.Capabilities.FilesSharing.Public = &data.CapabilitiesFilesSharingPublic{}
}

// h.c.Capabilities.FilesSharing.Public.Enabled is boolean
// h.c.Capabilities.FilesSharing.IsPublic.Enabled is boolean
h.c.Capabilities.FilesSharing.Public.Enabled = true

if h.c.Capabilities.FilesSharing.Public.Password == nil {
Expand All @@ -139,22 +139,22 @@ func (h *Handler) Init(c *config.Config) {
h.c.Capabilities.FilesSharing.Public.Password.EnforcedFor = &data.CapabilitiesFilesSharingPublicPasswordEnforcedFor{}
}

// h.c.Capabilities.FilesSharing.Public.Password.EnforcedFor.ReadOnly is boolean
// h.c.Capabilities.FilesSharing.Public.Password.EnforcedFor.ReadWrite is boolean
// h.c.Capabilities.FilesSharing.Public.Password.EnforcedFor.UploadOnly is boolean
// h.c.Capabilities.FilesSharing.IsPublic.Password.EnforcedFor.ReadOnly is boolean
// h.c.Capabilities.FilesSharing.IsPublic.Password.EnforcedFor.ReadWrite is boolean
// h.c.Capabilities.FilesSharing.IsPublic.Password.EnforcedFor.UploadOnly is boolean

// h.c.Capabilities.FilesSharing.Public.Password.Enforced is boolean
// h.c.Capabilities.FilesSharing.IsPublic.Password.Enforced is boolean

if h.c.Capabilities.FilesSharing.Public.ExpireDate == nil {
h.c.Capabilities.FilesSharing.Public.ExpireDate = &data.CapabilitiesFilesSharingPublicExpireDate{}
}
// h.c.Capabilities.FilesSharing.Public.ExpireDate.Enabled is boolean
// h.c.Capabilities.FilesSharing.IsPublic.ExpireDate.Enabled is boolean

// h.c.Capabilities.FilesSharing.Public.SendMail is boolean
// h.c.Capabilities.FilesSharing.Public.SocialShare is boolean
// h.c.Capabilities.FilesSharing.Public.Upload is boolean
// h.c.Capabilities.FilesSharing.Public.Multiple is boolean
// h.c.Capabilities.FilesSharing.Public.SupportsUploadOnly is boolean
// h.c.Capabilities.FilesSharing.IsPublic.SendMail is boolean
// h.c.Capabilities.FilesSharing.IsPublic.SocialShare is boolean
// h.c.Capabilities.FilesSharing.IsPublic.Upload is boolean
// h.c.Capabilities.FilesSharing.IsPublic.Multiple is boolean
// h.c.Capabilities.FilesSharing.IsPublic.SupportsUploadOnly is boolean

if h.c.Capabilities.FilesSharing.User == nil {
h.c.Capabilities.FilesSharing.User = &data.CapabilitiesFilesSharingUser{}
Expand Down
112 changes: 0 additions & 112 deletions internal/http/services/siteacc/data/account.go

This file was deleted.

Loading