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

Accessible link #260

Open
wants to merge 110 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
110 commits
Select commit Hold shift + click to select a range
c23cdb4
Added Gemfile.lock to source control because it's needed by Heroku
Sep 4, 2014
3a140d5
Revert "Added Gemfile.lock to source control because it's needed by H…
Sep 4, 2014
7961d24
beyond z customizations
adamdruppe Sep 4, 2014
c822e50
move domain to config
adamdruppe Sep 4, 2014
7069dd3
Merge pull request #1 from adamdruppe/master
sadleb Sep 19, 2014
6ea4a96
configuration and assets needed for production/staging deployment
adamdruppe Sep 23, 2014
1663a26
working configuration variables
adamdruppe Sep 23, 2014
6e29482
github comment addressing - readme and SSL option fixes
adamdruppe Sep 24, 2014
87d66a5
better example config
adamdruppe Sep 24, 2014
2cdd185
comment bad example and move domain for links out of webrick section
adamdruppe Sep 24, 2014
bb0cd11
Merge pull request #2 from adamdruppe/master
sadleb Sep 24, 2014
6b6c8a9
Production servers use postgresql. Add those defaults in the Gemfile.
Sep 25, 2014
6d20f73
Remove old test authenticator
Sep 25, 2014
f13a0bc
flow explanation
adamdruppe Sep 25, 2014
dfc551a
user db explanation
adamdruppe Sep 25, 2014
52ac9ba
clearer name instead of platform - public site is the one we did ours…
adamdruppe Sep 25, 2014
85cbac3
mmore config comment
adamdruppe Sep 25, 2014
9692cde
Merge pull request #3 from adamdruppe/master
sadleb Sep 25, 2014
96671b2
remove javascript that is useless but was maing the loading+autofocus…
adamdruppe Sep 27, 2014
1ac106f
Merge pull request #4 from adamdruppe/master
sadleb Sep 30, 2014
7378cb5
default service option in config
adamdruppe Oct 3, 2014
f63d729
analytics moved to config
adamdruppe Oct 3, 2014
6fe12a2
Merge pull request #5 from adamdruppe/master
sadleb Oct 3, 2014
e5fe15a
call logout on bz platform too to keep things straight
adamdruppe Oct 6, 2014
7e5eda3
Merge pull request #6 from adamdruppe/master
sadleb Oct 6, 2014
5c7e849
kill the redirect because it gives better interop with canvas in our …
adamdruppe Oct 7, 2014
6ab7e2a
Merge pull request #7 from adamdruppe/master
sadleb Oct 7, 2014
2e714fa
should show the log in page rather than log out to avoid template error
adamdruppe Oct 7, 2014
ba13c1e
Merge pull request #8 from adamdruppe/master
sadleb Oct 7, 2014
3e44c33
analytics update
adamdruppe Oct 7, 2014
a9c7f68
oops test code should have stayed
adamdruppe Oct 7, 2014
3a7f81e
Merge pull request #9 from adamdruppe/master
sadleb Oct 7, 2014
0edb323
Permit iframing for the resume module on canvas with a security ratio…
adamdruppe Dec 9, 2014
3f3498a
Merge pull request #10 from adamdruppe/master
sadleb Dec 9, 2014
c57c282
Remove unnecessary Log in link which looked wrong on mobile
adamdruppe Jan 12, 2015
c7239f4
Extend the gray so it looks consistent
adamdruppe Jan 12, 2015
1734ba2
Merge pull request #11 from adamdruppe/master
sadleb Jan 15, 2015
ac648b5
get to post so it doesnt log pws
adamdruppe Feb 26, 2015
2c08403
use hot dog style mobile nav menu
adamdruppe Feb 26, 2015
d69d9ad
Merge pull request #12 from adamdruppe/master
sadleb Mar 5, 2015
9772f82
Merge pull request #13 from adamdruppe/mobile
sadleb Apr 6, 2015
f5b5ab6
downcase username to ensure case insensitive emails throughout
adamdruppe Apr 8, 2015
cdcabd1
Merge pull request #14 from adamdruppe/master
sadleb Apr 8, 2015
3e59308
read login message flash from cross domain
adamdruppe Apr 21, 2015
0259417
configurable cookie domain
adamdruppe Apr 21, 2015
530f1f0
Merge pull request #15 from adamdruppe/master
sadleb Apr 21, 2015
d30db24
explain cookie_domain
adamdruppe Apr 21, 2015
aeab289
fix link to be more specific
adamdruppe Apr 30, 2015
8f8c067
Merge pull request #16 from adamdruppe/master
sadleb Apr 30, 2015
16b22d8
braven style cutover (sans h1 g image)
adamdruppe Aug 18, 2015
f7de6e0
Merge pull request #17 from adamdruppe/master
sadleb Aug 18, 2015
4f4a1b3
braven icon
adamdruppe Aug 18, 2015
49284f3
missing menu icon
adamdruppe Aug 19, 2015
e71197d
Merge pull request #18 from adamdruppe/master
sadleb Aug 19, 2015
4d6fd75
missing file and https font
adamdruppe Aug 20, 2015
1028c70
Merge pull request #19 from adamdruppe/master
sadleb Aug 20, 2015
b708963
Update beyondz.org to join.bebraven.org
Dec 10, 2015
c6f07e4
css optimization first pass
adamdruppe Dec 11, 2015
02b9741
images optimization
adamdruppe Dec 11, 2015
2dd2b4a
http -> https to skip redirects
adamdruppe Dec 11, 2015
64fd3d5
Merge conflicts from adamdruppe:master
Dec 11, 2015
9d4d5d6
Merge branch 'adamdruppe-master'
Dec 11, 2015
193d7c6
Backout change of www.beyondz.org to join.bebraven.org temporarily to…
Dec 11, 2015
2986d4c
Merge pull request #21 from adamdruppe/master
sadleb Dec 15, 2015
1da4332
remove old font
adamdruppe Dec 15, 2015
b5bd120
Change beyondz.org to join.bebraven.org
Dec 16, 2015
8c213d9
Responsive bit for login on small phone screens
adamdruppe Dec 17, 2015
914461f
simplify a bit more
adamdruppe Dec 17, 2015
9905981
Add Docker support (to be used with development repo)
Mar 14, 2016
4d09256
Add docker config
Mar 15, 2016
372d800
config tweak for docker
Mar 15, 2016
11b1264
Merge pull request #23 from sadleb/docker
sadleb Mar 15, 2016
76af90d
mobile menu script
adamdruppe Jul 13, 2016
05d7ee5
mobile menu script
adamdruppe Jul 13, 2016
b636ce6
use default so logout then login is consistent
adamdruppe Aug 5, 2016
d8464cc
use default so logout then login is consistent
adamdruppe Aug 5, 2016
5a9e215
Merge pull request #25 from adamdruppe/logout
sadleb Aug 5, 2016
3f78ce6
Merge pull request #24 from adamdruppe/little2
sadleb May 11, 2017
161a3ba
Merge pull request #22 from adamdruppe/master
sadleb May 11, 2017
54055d4
Fix Volunteer menus to match public website
May 11, 2017
c978d01
Merge pull request #26 from sadleb/master
sadleb May 11, 2017
9028689
Remove navigation menus since they don't add much value and are hard …
Jul 12, 2017
d199cc5
Merge pull request #27 from sadleb/remove_menus
sadleb Jul 12, 2017
d337c12
Missed a div in last commit. Also, format the file better
Jul 12, 2017
fc2c933
Merge pull request #28 from sadleb/missed_div
sadleb Jul 12, 2017
960f8fd
link in script for staging test (will be in separate pr)
adamdruppe Oct 26, 2017
a0ef07c
merge
adamdruppe Oct 26, 2017
50a8ce9
Merge pull request #29 from adamdruppe/little2
sadleb Nov 2, 2017
b4a343b
added docker-compose files
geethaka Mar 27, 2019
dd16680
Merge pull request #30 from geethaka/docker-compose
sadleb Apr 1, 2019
2a5136c
fix jessie eol issues
geethaka Apr 7, 2019
9b36ae9
people keep asking about this message, just telling them what they ne…
adamdruppe May 16, 2019
df32947
use service param if available in logout page's login form
bellmyer May 17, 2019
a4ffd20
Merge pull request #32 from adamdruppe/master
sadleb May 23, 2019
0be7766
Merge pull request #33 from bellmyer/allow-logout-page-service-param
sadleb May 23, 2019
c4f5961
Merge pull request #31 from geethaka/docker-compose
sadleb May 23, 2019
7e1ef51
Lock the gem versions to what we have on staging on production
sadleb May 23, 2019
ddd61c6
Update docker files to work with docker-compose v3 for a local develo…
Jul 23, 2019
1377785
Add / clarify some comments on the Docker stuff
Jul 23, 2019
b958acd
Merge pull request #39 from sadleb/docker3
sadleb Jul 23, 2019
74ed210
Cleanup our Docker dev env.
Sep 12, 2019
cbbe799
Fix up docker dev env so that changes made outside the container are …
Sep 12, 2019
e19d216
Merge pull request #41 from sadleb/docker_dev_env
sadleb Sep 12, 2019
ac998c6
Make Docker restarts/rebuilds work when new gem versions are available.
sadleb Oct 21, 2019
6103cb0
Merge pull request #42 from sadleb/dev_env
sadleb Oct 21, 2019
8fefb58
Staging and prod run Ruby 1.9.3. A prior gem I pinned was for Ruby 2.1.
sadleb Oct 21, 2019
3d69391
Merge pull request #43 from sadleb/gemversion
sadleb Oct 21, 2019
85d1014
Dev env more like staging/prod + checked in Gemfile.lock
sadleb Oct 21, 2019
4dc089e
Finally think I fixed the docker dev on rebuild/restart when gem vers…
sadleb Oct 21, 2019
2d7b6af
Merge pull request #44 from sadleb/gemversion
sadleb Oct 21, 2019
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
Empty file added .dockerignore
Empty file.
5 changes: 3 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@
.svn
config.yml
/config/config.yml
*.db
*.sqlite3
*.swp
*~
*.pidaproject
*.log
*.mo
*.prod
pkg
ssl
custom/*
Expand All @@ -18,4 +19,4 @@ resources/dev
.bundle
.vagrant
Vagrantfile
Gemfile.lock
vendor/*
38 changes: 38 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
# We currently use Ruby 1.9.3 in prod, but bundle install is failing with that in dev.
# We also can't use the newest ruby because it broke support for the syck gem in v2.2.
FROM ruby:1.9

#fix for jessie repo eol issues
RUN echo "deb [check-valid-until=no] http://cdn-fastly.deb.debian.org/debian jessie main" > /etc/apt/sources.list.d/jessie.list
RUN echo "deb [check-valid-until=no] http://archive.debian.org/debian jessie-backports main" > /etc/apt/sources.list.d/jessie-backports.list
RUN sed -i '/deb http:\/\/deb.debian.org\/debian jessie-updates main/d' /etc/apt/sources.list

# Note: gettext is installed to be able to use envsubst to inject config values
RUN apt-get -o Acquire::Check-Valid-Until=false update -qq && apt-get install -y build-essential libpq-dev gettext vim

# The rubycas Gemfile / gemspec doesn't specify a rails version since we use Apache Passenger modrails to run it in prod.
# Need this installed in the container to run the dev version.
#RUN gem install rails -v 3.2

# This is the version staging and prod run. This base image uses 1.9.0.
# Close enough that things should work, but update staging/prod if we have to get them in sync
#RUN gem uninstall bundler
#RUN gem install bundler -v 1.7.3

RUN mkdir /app
WORKDIR /app
# Note: in .dockerignore we exclude Gemfile.lock b/c we want bundle install to regenerate it for
# this version of Ruby. It doesn't get copied over to the container if you have one laying around from a non-Docker build.
COPY Gemfile /app/Gemfile
COPY Gemfile.lock /app/Gemfile.lock
COPY rubycas-server.gemspec /app/rubycas-server.gemspec

# See this article for why we copy to /tmp
# We have a runtime script to check this so we can deal
# with changes properly when gem versions get updated.
# https://nickjanetakis.com/blog/dealing-with-lock-files-when-using-ruby-node-and-elixir-with-docker
RUN bundle install && cp Gemfile.lock /tmp

# Do this after bundle install b/c if we do it before then changing any files
# causes bundle install to be invalidated and run again on the next build
COPY . /app
3 changes: 3 additions & 0 deletions Gemfile
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
source "http://rubygems.org"
gemspec

#gem "mysql2"
#gem "activerecord-mysql-adapter"
gem "pg"

# Gems for authenticators
group :ldap do
Expand Down
127 changes: 127 additions & 0 deletions Gemfile.lock
Original file line number Diff line number Diff line change
@@ -0,0 +1,127 @@
PATH
remote: .
specs:
rubycas-server (1.1.3.pre)
activerecord (>= 2.3.12, < 4.0)
activesupport (>= 2.3.12, < 4.0)
crypt-isaac (~> 0.9.1)
pg (= 0.17.1)
sinatra (~> 1.0)
sinatra-r18n (~> 1.1.0)

GEM
remote: http://rubygems.org/
specs:
activemodel (3.2.19)
activesupport (= 3.2.19)
builder (~> 3.0.0)
activerecord (3.2.19)
activemodel (= 3.2.19)
activesupport (= 3.2.19)
arel (~> 3.0.2)
tzinfo (~> 0.3.29)
activeresource (3.2.19)
activemodel (= 3.2.19)
activesupport (= 3.2.19)
activesupport (3.2.19)
i18n (~> 0.6, >= 0.6.4)
multi_json (~> 1.0)
addressable (2.3.6)
appraisal (0.4.1)
bundler
rake
arel (3.0.3)
builder (3.0.4)
capybara (1.1.2)
mime-types (>= 1.16)
nokogiri (>= 1.3.3)
rack (>= 1.0.0)
rack-test (>= 0.5.4)
selenium-webdriver (~> 2.0)
xpath (~> 0.1.4)
childprocess (0.5.3)
ffi (~> 1.0, >= 1.0.11)
crack (0.4.2)
safe_yaml (~> 1.0.0)
crypt-isaac (0.9.1)
diff-lcs (1.2.5)
ffi (1.9.3)
guard (1.4.0)
listen (>= 0.4.2)
thor (>= 0.14.6)
guard-rspec (2.0.0)
guard (>= 1.1)
rspec (~> 2.11)
i18n (0.6.11)
listen (0.7.3)
mime-types (2.3)
mini_portile (0.6.0)
multi_json (1.10.1)
net-ldap (0.1.1)
nokogiri (1.6.3.1)
mini_portile (= 0.6.0)
pg (0.17.1)
public_suffix (1.4.3)
r18n-core (1.1.11)
rack (1.6.11)
rack-protection (1.5.5)
rack
rack-test (0.6.3)
rack (>= 1.0)
rake (0.8.7)
rb-inotify (0.8.8)
ffi (>= 0.5.0)
rspec (2.99.0)
rspec-core (~> 2.99.0)
rspec-expectations (~> 2.99.0)
rspec-mocks (~> 2.99.0)
rspec-core (2.99.2)
rspec-expectations (2.99.2)
diff-lcs (>= 1.1.3, < 2.0)
rspec-mocks (2.99.2)
rubyzip (1.1.6)
safe_yaml (1.0.3)
selenium-webdriver (2.43.0)
childprocess (~> 0.5)
multi_json (~> 1.0)
rubyzip (~> 1.0)
websocket (~> 1.0)
sinatra (1.4.8)
rack (~> 1.5)
rack-protection (~> 1.4)
tilt (>= 1.3, < 3)
sinatra-r18n (1.1.11)
r18n-core (= 1.1.11)
sinatra (>= 1.3)
sqlite3 (1.3.9)
thor (0.19.1)
tilt (2.0.9)
tzinfo (0.3.55)
webmock (1.18.0)
addressable (>= 2.3.6)
crack (>= 0.3.2)
websocket (1.2.1)
xpath (0.1.4)
nokogiri (~> 1.3)

PLATFORMS
ruby

DEPENDENCIES
activeresource (>= 2.3.12, < 4.0)
appraisal (~> 0.4.1)
capybara (= 1.1.2)
guard (~> 1.4.0)
guard-rspec (= 2.0.0)
net-ldap (~> 0.1.1)
nokogiri (= 1.6.3.1)
pg
public_suffix (= 1.4.3)
rack-test (= 0.6.3)
rake (= 0.8.7)
rb-inotify (~> 0.8.8)
rspec
rspec-core
rubycas-server!
sqlite3 (~> 1.3.1)
webmock (~> 1.8)
66 changes: 66 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,23 @@
# RubyCAS-Server

## Beyond Z Customizations

The file lib/casserver/views/layout.erb has the login layout html. This is based on the main site, but it is modified, so must be maintained separately.

The public/ folder has image and css assets brought off the main site. These are simply downloaded from the production site and renamed - to do this, load the join.bebraven.org site in your browser, view source and find the link rel=styleshet near the top. Download that file and save it in here as public/beyondz.css. They do NOT need to be maintained separately at this time. Currently required are the logo, favicon, and stylesheet.

The file lib/beyondz.rb holds our authenticator. It uses a cooperative check_credentials http api on the public site to check against the main database. It is configured via config.yml for server (string), port (integer), ssl (boolean), and allow_self_signed (boolean) to know where to connect. The default ssl options is production-ready - it will verify certificates and use SSL. For development purposes, you may turn these options off with ssl: false.

## End user flow

The end user should always go to the service they want to use (portal.bebraven.org for example). The service then redirects them to the single sign on server, with a service parameter telling it to redirect them back once login is complete.

user goes to canvas -> canvas sends them to sso -> sso sends back to canvas

On the backend, the SSO server talks to the public site server and the service (canvas) server talks to the SSO server to validate login tickets. This should be SSL secured in production so the sso and canvas servers both need working client certificates, and the sso and public site servers need to be running https.

The user master record is stored on the public site. User records also need to exist on the service - so a bz.org and canvas user need to exist with the same email address for the login to succeed end to end.

## Copyright

Portions contributed by Matt Zukowski are copyright (c) 2011 Urbacon Ltd.
Expand Down Expand Up @@ -36,3 +54,51 @@ If you have questions, try the [RubyCAS Google Group](https://groups.google.com/

RubyCAS-Server is licensed for use under the terms of the MIT License.
See the LICENSE file bundled with the official RubyCAS-Server distribution for details.

## Running in a local development environment using Docker

Edit `/etc/hosts` and add these values.
```Shell
127.0.0.1 joinweb
127.0.0.1 ssoweb
127.0.0.1 canvasweb
```
Bring up the Join server locally b/c this Docker container is configured
to point at it for the user database / credentials. Do this by following
the instructions [here](https:/beyond-z/beyondz-platform#docker-setup)

Then, from your application root just run:
```Shell
docker-compose up -d
```
When complete, the app will be available at: `http://ssoweb:3002`

Note: the build will have a couple errors you can ignore. They don't
seem to impact the functioning of the app. Just ignore:
```Shell
fatal: Not a git repository (or any of the parent directories): .git
app/bin/rubycas-server maybe `gem pristine rubycas-server` will fix it?
```

Some things to keep in mind with Docker:
* If there are build errors, run `docker-compose logs` to see what they
are.
* The environment variables come from `docker-compose.yml` They are
injected into the container using `envsubst` in the
`./docker-compose/scripts/docker_compose_run.sh` script.
* If you change environment variables, rebuild to have them picked up by
running `./docker-compose/scripts/rebuild.sh
* There are more scripts in `./docker-compose/scripts` to help you work
with the container(s).
* If you change a file on the host (aka outside the container) it
does not take effect inside the container. This application is rarely
changed, so we don't mount a volume to allow files to be seamlessly
changed inside and outside. To have a change take effect run
`docker-compose/scripts/rebuild.sh`
* Lastly, and this is IMPORTANT, the version of Ruby that we run on
production is 1.9.3. However, getting Docker building with that
version has proven troublesome, so the Docker dev env runs Ruby 2.1. For
that reason, DO NOT check-in the `Gemfile.lock` built on your local dev
env or the update the `rubycas-server.gemspec`. If we have to rebuild
gems on prod, we'll have to bite the bullet and upgrade the server (or
consolidate the SSO server into the Join server
35 changes: 35 additions & 0 deletions config/config.example.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,26 @@
# The following are example configurations for each of these three methods:
#

# This is the domain of the main public website
# It is used by the view to generate links back to the rest of the site on the login form.
public_site_domain: join.bebraven.org

# This is used to clear the login_message cookie after it is set by
# a flash call on the Rails end. So it says like flash message saying
# "your password is now reset". We read that cookie, display the message,
# then clear the cookie so it isn't displayed twice. To clear the cookie,
# we need to know the matching settings. cookie_domain is the configurable one.
cookie_domain: .join.bebraven.org # this should be the *top* domain - so even for staging, it should be .join.bebraven.org still

# If someone goes directly to the login url, this is where they end up
# after a successful authentication. (They should never go directly there,
# but copy/pasting the link could drop necessary form fields and get them
# lost)
default_service: http://yoursite.com/login/cas

# This is the account number for google analytics. If this option is not
# here, analytics script will not be added.
google_analytics_account: UA-48011005-1

###
### WEBrick example
Expand Down Expand Up @@ -176,6 +196,21 @@ database:
# user_table: users
# username_column: username
# password_column: password
#

# Beyond Z Authenticator
authenticator:
class: BeyondZ::CustomAuthenticator
source: beyondz.rb
server: join.bebraven.org
# We can override ssl, port, and self signed options for dev
# The default is to use SSL.
# ssl: false
# port: 80
# allow_self_signed: true



#
# When replying to a CAS client's validation request, the server will normally
# provide the client with the authenticated user's username. However it is
Expand Down
43 changes: 43 additions & 0 deletions docker-compose.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
version: "3.5"
services:

ssoweb:
build:
context: .
command: /app/docker-compose/scripts/docker_compose_run.sh
# Temporarily replace the command above with this if you want the container to just stay open
# so you can connect and troubleshoot b/c the container exits when you bring it up.
#tty: true
ports:
- "3002:3002"
# Make changes done outside the container reflect inside the container without needing a rebuild by mounting a volume.
volumes:
- .:/app
networks:
- bravendev
depends_on:
- ssodb
environment:
RACK_ENV: development
DATABASE_NAME: casserver
DATABASE_USER: postgres
DATABASE_PASSWORD:
DATABASE_HOST: ssodb

ssodb:
image: postgres:9.3
volumes:
- sso-db:/var/lib/postgresql/data
networks:
- bravendev
environment:
POSTGRES_DB: casserver

# Note all Braven web app docker dev envs use this same network so they can talk to each other.
# E.g. the hostname joinweb will resolve inside the ssoweb container if they are on the same docker network.
networks:
bravendev:
name: braven_dev_network

volumes:
sso-db:
Loading