|
1 | | -CAS Overlay Template [](https://travis-ci.org/apereo/cas-overlay-template) |
2 | | -======================= |
| 1 | +OSF CAS by Center for Open Science |
| 2 | +================================== |
3 | 3 |
|
4 | | -Generic CAS WAR overlay to exercise the latest versions of CAS. This overlay could be freely used as a starting template for local CAS war overlays. |
| 4 | +`Master` Build Status: **TBI** |
5 | 5 |
|
6 | | -# Versions |
7 | | - |
8 | | -- CAS `6.1.x` |
9 | | -- JDK `11` |
10 | | - |
11 | | -# Overview |
12 | | - |
13 | | -To build the project, use: |
14 | | - |
15 | | -```bash |
16 | | -# Use --refresh-dependencies to force-update SNAPSHOT versions |
17 | | -./gradlew[.bat] clean build |
18 | | -``` |
| 6 | +`Develop` Build Status: **TBI** |
19 | 7 |
|
20 | | -To see what commands are available to the build script, run: |
| 8 | +Versioning Scheme: [](http://calver.org) |
21 | 9 |
|
22 | | -```bash |
23 | | -./gradlew[.bat] tasks |
24 | | -``` |
25 | | - |
26 | | -To launch into the CAS command-line shell: |
27 | | - |
28 | | -```bash |
29 | | -./gradlew[.bat] downloadShell runShell |
30 | | -``` |
31 | | - |
32 | | -To fetch and overlay a CAS resource or view, use: |
33 | | - |
34 | | -```bash |
35 | | -./gradlew[.bat] getResource -PresourceName=[resource-name] |
36 | | -``` |
37 | | - |
38 | | -To list all available CAS views and templates: |
39 | | - |
40 | | -```bash |
41 | | -./gradlew[.bat] listTemplateViews |
42 | | -``` |
43 | | - |
44 | | -To unzip and explode the CAS web application file and the internal resources jar: |
45 | | - |
46 | | -```bash |
47 | | -./gradlew[.bat] explodeWar |
48 | | -``` |
| 10 | +License: [](https://github.com/apereo/cas/blob/master/LICENSE) |
49 | 11 |
|
50 | | -# Configuration |
| 12 | +# About |
51 | 13 |
|
52 | | -- The `etc` directory contains the configuration files and directories that need to be copied to `/etc/cas/config`. |
| 14 | +OSF CAS is the centralized authentication and authorization service for the [OSF](https://osf.io/) and its services such as [OSF Preprints](https://osf.io/preprints/) and [OSF Registries](https://osf.io/registries). |
53 | 15 |
|
54 | | -```bash |
55 | | -./gradlew[.bat] copyCasConfiguration |
56 | | -``` |
| 16 | +# Features |
57 | 17 |
|
58 | | -- The specifics of the build are controlled using the `gradle.properties` file. |
| 18 | +* OSF username and password login |
| 19 | +* OSF username and verification key login |
| 20 | +* OSF two-factor authentication |
| 21 | +* **WIP** - Delegated authentication |
| 22 | +* **TBI** - OAuth authorization server for OSF |
| 23 | +* **TBI** - SAML service provider |
59 | 24 |
|
60 | | -## Adding Modules |
| 25 | +# Implementations |
61 | 26 |
|
62 | | -CAS modules may be specified under the `dependencies` block of the [Gradle build script](build.gradle): |
| 27 | +The implementation of OSF CAS is based on [Apereo CAS 6.2.x](https://github.com/apereo/cas/tree/6.2.x) via [CAS Overlay Template 6.2.x](https://github.com/apereo/cas-overlay-template/tree/6.2). Refer to [CAS Documentaion 6.2.x](https://apereo.github.io/cas/6.2.x/) for more details. |
63 | 28 |
|
64 | | -```gradle |
65 | | -dependencies { |
66 | | - compile "org.apereo.cas:cas-server-some-module:${project.casVersion}" |
67 | | - ... |
68 | | -} |
69 | | -``` |
| 29 | +## Legacy Implementations |
70 | 30 |
|
71 | | -To collect the list of all project modules and dependencies: |
| 31 | +A legacy version can be found at [CAS Overlay](https://github.com/CenterForOpenScience/cas-overlay), which was built on [Jasig CAS 4.1.x](https://github.com/apereo/cas/tree/4.1.x) via [CAS Overlay Template 4.1.x](https://github.com/apereo/cas-overlay-template/tree/4.1). |
72 | 32 |
|
73 | | -```bash |
74 | | -./gradlew[.bat] allDependencies |
75 | | -``` |
| 33 | +# Versions |
76 | 34 |
|
77 | | -### Clear Gradle Cache |
| 35 | +- OSF CAS `20.0.x` |
| 36 | +- Apereo CAS `6.2.x` |
| 37 | +- PostgreSQL `9.6` |
| 38 | +- JDK `11` |
78 | 39 |
|
79 | | -If you need to, on Linux/Unix systems, you can delete all the existing artifacts (artifacts and metadata) Gradle has downloaded using: |
| 40 | +# Build and Run OSF CAS |
80 | 41 |
|
81 | | -```bash |
82 | | -# Only do this when absolutely necessary |
83 | | -rm -rf $HOME/.gradle/caches/ |
84 | | -``` |
| 42 | +## OSF |
85 | 43 |
|
86 | | -Same strategy applies to Windows too, provided you switch `$HOME` to its equivalent in the above command. |
| 44 | +OSF CAS requires a working OSF running locally. Refer to OSF's [README-docker-compose.md](https://github.com/CenterForOpenScience/osf.io/blob/develop/README-docker-compose.md) for how to set up and run OSF with `docker-compose`. Must disable `fakeCAS` to free port `8080`. |
87 | 45 |
|
88 | | -# Deployment |
| 46 | +In `cas.propeties`, global JDBC settings can be found [here](https://github.com/cslzchen/osf-cas/blob/21bb277cc38b3364fd67a632c0bc7b7a6ffc9efd/etc/cas/config/cas.properties#L69-L73) and JPA specific settings can be found [here](https://github.com/cslzchen/osf-cas/blob/21bb277cc38b3364fd67a632c0bc7b7a6ffc9efd/etc/cas/config/cas.properties#L54-L60). |
89 | 47 |
|
90 | | -- Create a keystore file `thekeystore` under `/etc/cas`. Use the password `changeit` for both the keystore and the key/certificate entries. This can either be done using the JDK's `keytool` utility or via the following command: |
| 48 | +## CAS DB |
91 | 49 |
|
92 | | -```bash |
93 | | -./gradlew[.bat] createKeystore |
94 | | -``` |
| 50 | +OSF CAS is configured to use the [JPA Ticket Registry](https://apereo.github.io/cas/6.2.x/ticketing/Configuring-Ticketing-Components.html#ticket-registry) for durable ticket storage. Thus, a relational database is required. Set up a `PostgreSQL@9.6` server and update *JPA Ticket Registry* [settings](https://github.com/cslzchen/osf-cas/blob/21bb277cc38b3364fd67a632c0bc7b7a6ffc9efd/etc/cas/config/cas.properties#L65-L113) in `cas.propeties` accordingly. Must use a port other than the already occupied `5432`. |
95 | 51 |
|
96 | | -- Ensure the keystore is loaded up with keys and certificates of the server. |
| 52 | +## Signing and Encryption Keys |
97 | 53 |
|
98 | | -On a successful deployment via the following methods, CAS will be available at: |
| 54 | +Refer to [settings](https://github.com/cslzchen/osf-cas/blob/21bb277cc38b3364fd67a632c0bc7b7a6ffc9efd/etc/cas/config/cas.properties#L117-L133) in `cas.properties` for signing and encrypting client session and ticket granting cookie. |
99 | 55 |
|
100 | | -* `https://cas.server.name:8443/cas` |
| 56 | +## Authentication Delegation |
101 | 57 |
|
102 | | -## Executable WAR |
| 58 | +### ORCiD Login |
103 | 59 |
|
104 | | -Run the CAS web application as an executable WAR: |
| 60 | +Set up a developer app at [ORCiD](https://orcid.org/developer-tools) with `http://localhost:8080/login` and `http://192.168.168.167:8080/login` as *redirect URIs*. Update |
| 61 | +`cas.authn.pac4j.orcid.id` and `cas.authn.pac4j.orcid.secret` in `cas.properties` [settings](https://github.com/cslzchen/osf-cas/blob/21bb277cc38b3364fd67a632c0bc7b7a6ffc9efd/etc/cas/config/cas.properties#L186-L192). |
105 | 62 |
|
106 | | -```bash |
107 | | -./gradlew[.bat] run |
108 | | -``` |
| 63 | +### `fakeCAS` Login |
109 | 64 |
|
110 | | -Debug the CAS web application as an executable WAR: |
| 65 | +With OSF CAS running locally as the authentication server for OSF, `fakeCAS` can be configured to serve as an identity provider. Simply update `fakecas` in OSF's [docker-compose.yaml](https://github.com/CenterForOpenScience/osf.io/blob/dc87c86b2afb7ad4e801b23c6428e3d2169e3e36/docker-compose.yml#L235-L247) to listen on port 8081. |
111 | 66 |
|
112 | | -```bash |
113 | | -./gradlew[.bat] debug |
114 | 67 | ``` |
115 | | - |
116 | | -Run the CAS web application as a *standalone* executable WAR: |
117 | | - |
118 | | -```bash |
119 | | -./gradlew[.bat] clean executable |
| 68 | +fakecas: |
| 69 | + image: quay.io/centerforopenscience/fakecas:master |
| 70 | + command: fakecas -host=0.0.0.0:8081 -osfhost=localhost:5000 -dbaddress=postgres://postgres@postgres:5432/osf?sslmode=disable |
| 71 | + restart: unless-stopped |
| 72 | + ports: |
| 73 | + - 8081:8081 |
| 74 | + depends_on: |
| 75 | + - postgres |
| 76 | + stdin_open: true |
120 | 77 | ``` |
121 | 78 |
|
122 | | -## External |
123 | | - |
124 | | -Deploy the binary web application file `cas.war` after a successful build to a servlet container of choice. |
125 | | - |
126 | | -## Docker |
127 | | - |
128 | | -The following strategies outline how to build and deploy CAS Docker images. |
| 79 | +Related settings in `cas.propeties` can be found [here](https://github.com/cslzchen/osf-cas/blob/21bb277cc38b3364fd67a632c0bc7b7a6ffc9efd/etc/cas/config/cas.properties#L196-L199). |
129 | 80 |
|
130 | | -### Jib |
| 81 | +## Build and Run |
131 | 82 |
|
132 | | -The overlay embraces the [Jib Gradle Plugin](https://github.com/GoogleContainerTools/jib) to provide easy-to-use out-of-the-box tooling for building CAS docker images. Jib is an open-source Java containerizer from Google that lets Java developers build containers using the tools they know. It is a container image builder that handles all the steps of packaging your application into a container image. It does not require you to write a Dockerfile or have Docker installed, and it is directly integrated into the overlay. |
| 83 | +It is recommended to use the `Dockerfile` and the provided scripts to build and run CAS. |
133 | 84 |
|
134 | 85 | ```bash |
135 | | -./gradlew build jibDockerBuild |
136 | | -``` |
137 | | - |
138 | | -### Dockerfile |
139 | | - |
140 | | -You can also use the native Docker tooling and the provided `Dockerfile` to build and run CAS. |
141 | | - |
142 | | -```bash |
143 | | -chmod +x *.sh |
144 | 86 | ./docker-build.sh |
145 | 87 | ./docker-run.sh |
146 | 88 | ``` |
| 89 | + |
| 90 | +Refer to Apereo's [README.md](https://github.com/apereo/cas-overlay-template/tree/6.2#cas-overlay-template-) for more options. |
0 commit comments