Skip to content

Commit 8012114

Browse files
committed
Rewrite University Account authentication for Nevar
1 parent c85ff4f commit 8012114

File tree

1 file changed

+80
-48
lines changed

1 file changed

+80
-48
lines changed

content/reference/web-hosting/university-account-authentication.md

Lines changed: 80 additions & 48 deletions
Original file line numberDiff line numberDiff line change
@@ -11,26 +11,41 @@ toc: true
1111
You can configure your site, or a subset of pages, to require user
1212
authentication with a University Account (formerly known as Raven).
1313

14-
## With .htaccess using Ucam-WebAuth
14+
## Using Ucam-WebAuth
1515

16-
{{< alert type="warning" >}}
17-
Legacy Raven is being retired in December 2024, which means Ucam-WebAuth
18-
will no longer be an option to directly authenticate University Accounts
19-
against the official university-provided service.
20-
21-
The SRCF hosts [Nevar](https://nevar.srcf.net), an alternative service
22-
which allows site visitors to authenticate with their University Account
23-
over a university-supported protocol (OAuth2), and allows websites to
24-
continue requesting authentication information via Ucam-WebAuth. This
25-
replacement service will be made the default on the SRCF webserver when
26-
Legacy Raven is switched off, in order to maintain site availability.
27-
{{< /alert >}}
16+
*Ucam-WebAuth* is a simple
17+
[authentication protocol](https://nevar.srcf.net/static/waa2wls-protocol.txt),
18+
originally designed within the University for the Legacy Raven service.
19+
It works similarly to OAuth2, and consists of two parties:
20+
21+
- *Web Login Service* (servers like Raven, which ask you to authenticate
22+
with your credentials and provide proof of authentication to a WAA)
23+
24+
- *Web Application Agent* (clients like
25+
[mod\_ucam\_webauth](https://github.com/cambridgeuniversity/mod_ucam_webauth)
26+
for Apache or
27+
[python-ucam-webauth](https://github.com/danielrichman/python-ucam-webauth),
28+
which redirect you through a WLS in order to identify a site visitor)
29+
30+
The SRCF hosts two of its own WLS servers:
31+
32+
- [Nevar](https://nevar.srcf.net), an alternative to Raven which allows
33+
site visitors to authenticate with their University Account over a
34+
university-supported protocol (OAuth2)
35+
36+
- [Goose](https://auth.srcf.net), a standalone service which allows site
37+
visitors to authenticate with their SRCF account credentials
38+
39+
As of December 2024, the University retired the Legacy Raven service,
40+
but they continue to run their own proxy service similar to Nevar.
41+
42+
### Configuring Ucam-WebAuth in .htaccess
2843

29-
The SRCF has the
30-
[mod\_ucam\_webauth](https://github.com/cambridgeuniversity/mod_ucam_webauth)
31-
module installed, which makes it easy to do basic authentication using Raven.
44+
The SRCF uses Apache as its webserver, with the mod\_ucam\_webauth
45+
module installed, which makes it easy to do basic authentication using
46+
the Ucam-WebAuth protocol.
3247
[Full documentation](https://github.com/cambridgeuniversity/mod_ucam_webauth/blob/master/README.Config)
33-
is available, though here are a few common cases.
48+
is available for the module, though here are a few common cases.
3449

3550
To protect a directory (whether `public_html` for your entire site, or a
3651
subdirectory of it), create or edit a `.htaccess` file in that
@@ -41,9 +56,17 @@ AuthType Ucam-WebAuth
4156
Require valid-user
4257
```
4358

44-
This will permit access to anyone with a 'current' Raven account, i.e.
45-
active students and staff. To permit access to *any* Raven account
46-
(including graduated students), add a *Ptags* directive:
59+
{{< alert type="info" >}}
60+
A file beginning with a `.` is a hidden file on Linux and UNIX systems.
61+
You may need to manually disable the hiding of these files (e.g. Ctrl-h
62+
in Nautilus, the file manager program of the GNOME desktop environment).
63+
If using the web terminal or connecting over SSH, `ls -a` will include
64+
hidden files.
65+
{{< /alert >}}
66+
67+
This will permit access to anyone with a 'current' University Account,
68+
i.e. active students and staff. To permit access to *any* University
69+
Account (including graduated students), add a *Ptags* directive:
4770

4871
```apache
4972
AARequiredPtags none
@@ -64,15 +87,18 @@ To limit page access to group account admins only, add a `unix-group`
6487
*Require* directive:
6588

6689
```apache
67-
Require unix-group <groupname>
90+
Require unix-group cuxs
6891
```
6992

70-
You can also list specific users:
93+
You can also list one or more specific users:
7194

7295
```apache
73-
Require user <crsid> <crsid>...
96+
Require user spqr2 spqr3
7497
```
7598

99+
(Of course, replace `cuxs` or `spqr2 spqr3` with the appropriate group
100+
names or CRSids.)
101+
76102
To create a 'logout' link, add the following to your .htaccess file
77103
(which will create `/logout` relative to the directory containing the
78104
`.htaccess` file):
@@ -83,41 +109,47 @@ To create a 'logout' link, add the following to your .htaccess file
83109
</FilesMatch>
84110
```
85111

86-
You can access a Raven-authenticated user's CRSid using the
87-
`REMOTE_USER` (or `AAPRINCIPAL`) environment variables. For example,
88-
adding the following to a PHP page like `index.php` will display a
89-
customised welcome message on login:
112+
`AAAuthService` and `AALogoutService` can be used to change the URLs to
113+
the WLS server. Websites hosted on the SRCF (i.e. on webserver.srcf.net
114+
aka. sinkhole) use SRCF Nevar by default, which is equivalent to:
90115

91-
```php
92-
<?php
93-
echo "Hello {$_SERVER['REMOTE_USER']}!"
94-
?>
116+
```apache
117+
AAAuthService https://nevar.srcf.net/wls/authenticate
118+
AALogoutService https://nevar.srcf.net/oidc/logout
95119
```
96120

97-
### Example configuration
121+
To use SRCF Goose instead:
98122

99123
```apache
100-
RewriteEngine On
101-
RewriteCond %{HTTPS} off
102-
RewriteRule (.*) https://%{HTTP_HOST}%{REQUEST_URI} [R=permanent]
124+
AAAuthService https://auth.srcf.net/wls/authenticate
125+
AALogoutService https://auth.srcf.net/logout
126+
```
103127

104-
AuthType Ucam-WebAuth
105-
Require user CRSID
128+
{{< alert type="warning" >}}
129+
Goose does not provide the `current` ptag, so you must also set
130+
`AARequiredPtags none` in order to authenticate users.
131+
{{< /alert >}}
132+
133+
Or to use the University's own Raven proxy:
134+
135+
```apache
136+
AAAuthService https://legacy.raven.cam.ac.uk/auth/authenticate.html
137+
AALogoutService https://raven.cam.ac.uk/auth/logout.html
106138
```
107139

108-
Replace CRSID with your CRSID.
140+
## Reading the user's CRSid
109141

110-
The `Rewrite` section makes all connections to `.../wp-admin/` use SSL
111-
which will protect your password, the `AuthType` section uses Raven to
112-
restrict access to the directory, you probably want to use your CRSID on
113-
the `Require` line.
142+
You can access an authenticated user's CRSid using the `REMOTE_USER` (or
143+
`AAPRINCIPAL`) environment variables in PHP and CGI scripts.
114144

115-
{{< alert type="info" >}}
116-
A file beginning with a `.` is a hidden file on unix. If you are using
117-
the gnome [graphical desktop](../webdesktop/) then pressing Ctrl-h in
118-
nautilus (the default file browser) will show hidden files. (If you are
119-
using something else you should be able to work out what to do.)
120-
{{< /alert >}}
145+
For example, adding the following to a PHP page like `index.php` will
146+
display a customised welcome message on login:
147+
148+
```php
149+
<?php
150+
echo "Hello {$_SERVER['REMOTE_USER']}!"
151+
?>
152+
```
121153

122154
## Within an application
123155

0 commit comments

Comments
 (0)