Skip to content Skip to site navigation

Common WebAuth Directives

WebAuth is being deprecated and will be retired soon.

To get help transitioning from WebAuth to SAML, visit SAML (Authentication) or the WebAuth Announcement page.

Overview

There are a myriad ways to protect your pages with WebAuth, but in real life you'll probably need only a small handful of directives to get the protection you want. We've gathered these common WebAuth directives onto one page so you can copy and paste them directly into your .htaccess files.

Note: The Workgroup Manager is a web application that allows you to define groups of Stanford community members for use in various online applications (not just a web page or group of pages) that also utilizes web authentication (WebAuth). See the overview for Workgroups and Workgroup Manager if this is the type of authentication you need.

Stanford only

This allows only people with a Stanford affiliation to see your web page.

AuthType WebAuth
require privgroup stanford:stanford
require privgroup stanford:administrative
require privgroup stanford:academic

Since you have a Stanford affiliation you would of course be able to see your own page.

One Stanford person

This allows only one particular Stanford person to see your web page.

AuthType WebAuth
require user sunetid1

Don't forget to edit this code in order to include real people. For example, if you copied and pasted this code into your .htaccess file you'd want to replace "sunetid1" with the actual SUNet ID of the person you wanted to see your web page. If, for example, that person's SUNet ID were gsmith, you would edit the code so it looked like this:

AuthType WebAuth
require user gsmith

If you wanted to be able to see your web page also, you'd have to add your own SUNet ID too. See the instructions for "More than one Stanford person" below.

More than one Stanford person

This allows only Stanford people of your choice to see your web page.

AuthType WebAuth
require user sunetid1 sunetid2 sunetid3

Don't forget to edit this code to include real people. For example, if you copied and pasted this code into your .htaccess file you'd want to replace "sunetid1", "sunetid2", etc., with the actual SUNet IDs of the people you wanted to see your web page. This would probably include you. So, if your SUNet ID was "jdoe" and you wanted people whose SUNet IDs were gsmith and lwilliams to see your page, you would edit the code so it looked like this:

AuthType WebAuth
require user jdoe gsmith lwilliams

Only members of a Stanford group

This allows only certain large categories of Stanford people to see your web page:

Only students:

AuthType WebAuth
require privgroup stanford:student

Only faculty:

AuthType WebAuth
require privgroup stanford:faculty

Only staff:

AuthType WebAuth
require privgroup stanford:staff

These aren't the only kinds of groups. If you want to create your own "privgroup" you can do so by going to workgroup.stanford.edu.

Note that, if you want to see your web page but aren't a member of the group you specify, you'll have to add an extra line that includes your SUNet ID. If, for example, you were a staff member whose SUNet ID was "jdoe" and were WebAuthing a page so only students could see it, you'd include yourself this way:

AuthType WebAuth
require privgroup stanford:student
require user jdoe

Transferring files via the web

This allows you to put a file onto the web and allow only certain people to access the file and download it to their system.

Use the WebAuth directives for "One Stanford person" or "More than one Stanford person", depending on your needs.

Last modified March 7, 2024