CAS on Page

Published by

on

This instruction is about how to secure page on the WordPress by using CAS.

For example, we want users to authenticate before they could access other pages.

Page one -> CAS authentication -> Page two

First, we need to three plugins in order to implement this feature.

WP Classify, Quick Page / Post Redirect, Page Restrict, and PublishPress Permissions. On this post, we will only focus on latter two plugins.

First of all, you will have two pages. One is login page and the other is content page, which you want to protect.

One the login page, make the following configuration:

  1. Make sure “make redirect active” is check
  2. Fill out redirect / destination URL
    https://cas.byu.edu/cas/login?service=http://yourdomainname.byu.edu/protect-content-page/
  3. Type of redirect: 301 permanent

Also, make sure reading exception has “yes” selected for everyone including anonymous on “WP Roles” tab. You don’t need to worry Groups and Users tabs. (You want everyone can view and access this login page)

One the content, protected page, you need have the following configuration on the page.

You need to have a check mark on “restriction page”

One reading exceptions, make sure that it’s “Blocked” both on “this page” and “sub-page” for Anonymous because you only want people who pass authentication to view protected content page. (also, it’s only on WP Roles tab)

The last thing that you need to do is to make sure that protect page can’t be accessed or viewed by going directly to the page.

You should see “Page not found message” when you access the page.

Then, make sure that you link to login page and you are done!

Previous Post
Next Post