Skip to content

Commit

Permalink
MODLOGSAML-111: Current Master merged into the branch.
Browse files Browse the repository at this point in the history
  • Loading branch information
barbaraloehle committed Nov 14, 2023
2 parents b11bb0c + 583700d commit 6d37057
Show file tree
Hide file tree
Showing 36 changed files with 2,004 additions and 336 deletions.
91 changes: 91 additions & 0 deletions .github/workflows/api-doc.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,91 @@
name: api-doc

# https://dev.folio.org/guides/api-doc/

# API_TYPES: string: The space-separated list of types to consider.
# One or more of 'RAML OAS'.
# e.g. 'OAS'
#
# API_DIRECTORIES: string: The space-separated list of directories to search
# for API description files.
# e.g. 'src/main/resources/openapi'
# NOTE: -- Also add each separate path to each of the "on: paths:" sections.
# e.g. 'src/main/resources/openapi/**'
#
# API_EXCLUDES: string: The space-separated list of directories and files
# to exclude from traversal, in addition to the default exclusions.
# e.g. ''

env:
API_TYPES: 'RAML'
API_DIRECTORIES: 'ramls'
API_EXCLUDES: ''
OUTPUT_DIR: 'folio-api-docs'
AWS_S3_BUCKET: 'foliodocs'
AWS_S3_FOLDER: 'api'
AWS_S3_REGION: 'us-east-1'
AWS_S3_ACCESS_KEY_ID: ${{ secrets.S3_ACCESS_KEY_ID }}
AWS_S3_ACCESS_KEY: ${{ secrets.S3_SECRET_ACCESS_KEY }}

on:
push:
branches: [ main, master ]
paths:
- 'ramls/**'
tags: '[vV][0-9]+.[0-9]+.[0-9]+*'

jobs:
api-doc:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
with:
ref: ${{ github.REF }}
submodules: recursive
- name: Prepare folio-tools
run: |
git clone https://github.com/folio-org/folio-tools
cd folio-tools/api-doc \
&& yarn install \
&& pip3 install -r requirements.txt
- name: Obtain version if release tag
if: ${{ startsWith(github.ref, 'refs/tags/v') }}
run: |
version=$(echo ${GITHUB_REF#refs/tags/[vV]} | awk -F'.' '{ printf("%d.%d", $1, $2) }')
echo "VERSION_MAJ_MIN=${version}" >> $GITHUB_ENV
- name: Set some vars
run: |
echo "REPO_NAME=${GITHUB_REPOSITORY##*/}" >> $GITHUB_ENV
- name: Report some info
run: |
echo "REPO_NAME=${{ env.REPO_NAME }}"
- name: Do api-doc
run: |
if test -n "${{ env.VERSION_MAJ_MIN }}"; then
echo "Docs for release version ${{ env.VERSION_MAJ_MIN }}"
option_release=$(echo "--version ${{ env.VERSION_MAJ_MIN }}")
else
option_release=""
fi
python3 folio-tools/api-doc/api_doc.py \
--loglevel info \
--types ${{ env.API_TYPES }} \
--directories ${{ env.API_DIRECTORIES }} \
--excludes ${{ env.API_EXCLUDES }} \
--output ${{ env.OUTPUT_DIR }} $option_release
- name: Show generated files
working-directory: ${{ env.OUTPUT_DIR }}
run: ls -R
- name: Publish to AWS S3
uses: sai-sharan/[email protected]
with:
access_key: ${{ env.AWS_S3_ACCESS_KEY_ID }}
secret_access_key: ${{ env.AWS_S3_ACCESS_KEY }}
region: ${{ env.AWS_S3_REGION }}
source: ${{ env.OUTPUT_DIR }}
destination_bucket: ${{ env.AWS_S3_BUCKET }}
destination_prefix: ${{ env.AWS_S3_FOLDER }}
delete: false
quiet: false

65 changes: 65 additions & 0 deletions .github/workflows/api-lint.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
name: api-lint

# https://dev.folio.org/guides/api-lint/

# API_TYPES: string: The space-separated list of types to consider.
# One or more of 'RAML OAS'.
# e.g. 'OAS'
#
# API_DIRECTORIES: string: The space-separated list of directories to search
# for API description files.
# e.g. 'src/main/resources/openapi'
# NOTE: -- Also add each separate path to each of the "on: paths:" sections.
# e.g. 'src/main/resources/openapi/**'
#
# API_EXCLUDES: string: The space-separated list of directories and files
# to exclude from traversal, in addition to the default exclusions.
# e.g. ''
#
# API_WARNINGS: boolean: Whether to cause Warnings to be displayed,
# and to fail the workflow.
# e.g. false

env:
API_TYPES: 'RAML'
API_DIRECTORIES: 'ramls'
API_EXCLUDES: ''
API_WARNINGS: false

on:
push:
paths:
- 'ramls/**'
pull_request:
paths:
- 'ramls/**'

jobs:
api-lint:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
with:
submodules: recursive
- name: Prepare folio-tools
run: |
git clone https://github.com/folio-org/folio-tools
cd folio-tools/api-lint \
&& yarn install \
&& pip3 install -r requirements.txt
- name: Configure default options
run: |
echo "OPTION_WARNINGS=''" >> $GITHUB_ENV
- name: Configure option warnings
if: ${{ env.API_WARNINGS == 'true' }}
run: |
echo "OPTION_WARNINGS=--warnings" >> $GITHUB_ENV
- name: Do api-lint
run: |
python3 folio-tools/api-lint/api_lint.py \
--loglevel info \
--types ${{ env.API_TYPES }} \
--directories ${{ env.API_DIRECTORIES }} \
--excludes ${{ env.API_EXCLUDES }} \
${{ env.OPTION_WARNINGS }}
46 changes: 46 additions & 0 deletions .github/workflows/api-schema-lint.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
name: api-schema-lint

# https://dev.folio.org/guides/describe-schema/

# API_DIRECTORIES: string: The space-separated list of directories to search
# for JSON Schema files.
# e.g. 'src/main/resources/openapi'
# NOTE: -- Also add each separate path to each of the "on: paths:" sections.
# e.g. 'src/main/resources/openapi/**'
#
# API_EXCLUDES: string: The space-separated list of directories and files
# to exclude from traversal, in addition to the default exclusions.
# e.g. ''

env:
API_DIRECTORIES: 'ramls'
API_EXCLUDES: ''

on:
push:
paths:
- 'ramls/**'
pull_request:
paths:
- 'ramls/**'

jobs:
api-schema-lint:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
with:
submodules: recursive
- name: Prepare folio-tools
run: |
git clone https://github.com/folio-org/folio-tools
cd folio-tools/api-schema-lint \
&& yarn install \
&& pip3 install -r requirements.txt
- name: Do api-schema-lint
run: |
python3 folio-tools/api-schema-lint/api_schema_lint.py \
--loglevel info \
--directories ${{ env.API_DIRECTORIES }} \
--excludes ${{ env.API_EXCLUDES }}
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -6,3 +6,4 @@ bin/
*.jks
.classpath
.project
saml-signing-cert.*
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM folioci/alpine-jre-openjdk11:latest
FROM folioci/alpine-jre-openjdk17:latest

# Install latest patch versions of packages: https://pythonspeed.com/articles/security-updates-in-docker/
USER root
Expand Down
2 changes: 1 addition & 1 deletion GUIDE.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ Examples:

### SP metadata

An XML file that describes the Service Point's configuration like successful login callback URL, and the encryption keys.
An XML file that describes the Service Provider's configuration like successful login callback URL, and the encryption keys.

### SAML binding

Expand Down
9 changes: 2 additions & 7 deletions Jenkinsfile
Original file line number Diff line number Diff line change
Expand Up @@ -4,18 +4,13 @@ buildMvn {
publishModDescriptor = 'yes'
mvnDeploy = 'yes'
doKubeDeploy = true
buildNode = 'jenkins-agent-java11'

doApiLint = true
doApiDoc = true
apiTypes = 'RAML'
apiDirectories = 'ramls'
buildNode = 'jenkins-agent-java17'

doDocker = {
buildJavaDocker {
publishMaster = 'yes'
healthChk = 'yes'
healthChkCmd = 'curl -sS --fail -o /dev/null http://localhost:8081/apidocs/ || exit 1'
healthChkCmd = 'wget --no-verbose --tries=1 --spider http://localhost:8081/admin/health || exit 1'
}
}
}
Expand Down
18 changes: 18 additions & 0 deletions NEWS.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,21 @@
## 2.7.0 - 2023-10-12

* [MODLOGSAML-173](https://issues.folio.org/browse/MODLOGSAML-173) Upgrade dependencies for Poppy
* [MODLOGSAML-172](https://issues.folio.org/browse/MODLOGSAML-172) Support new mod-authtoken /token/sign endpoint
* [Explain pac4j authentication and authorization mechanisms](https://github.com/folio-org/mod-login-saml/pull/146)
* [MODLOGSAML-169](https://issues.folio.org/browse/MODLOGSAML-169) Update to Java 17
* [FOLIO-3678](https://issues.folio.org/browse/FOLIO-3678) [MODLOGSAML-160](https://issues.folio.org/browse/MODLOGSAML-160) Enable API-related GitHub Workflows, replace those Jenkins stages

## 2.6.2 - 2023-06-01

* [MODLOGSAML-166](https://issues.folio.org/browse/MODLOGSAML-166) xmlsec 2.3.3, woodstox-core 6.5.0 fixing DoS (CVE-2022-40152)
* [MODLOGSAML-165](https://issues.folio.org/browse/MODLOGSAML-165) json-smart 2.4.10 fixing DoS (CVE-2023-1370)

## 2.6.1 - 2023-04-01

* [MODLOGSAML-159](https://issues.folio.org/browse/MODLOGSAML-159) OpenSSL 3.0.8 fixing 8 vulns
* [MODLOGSAML-161](https://issues.folio.org/browse/MODLOGSAML-161) Use TLSv1.2, not SSL, in SSLContext.getInstance

## 2.6.0 - 2023-02-16

* [MODLOGSAML-157](https://issues.folio.org/browse/MODLOGSAML-157) Upgrade dependences: pac4j 5.7.0, RMB 35.0.6, Vert.x 4.3.8
Expand Down
19 changes: 14 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,9 @@ Endpoints are documented in [RAML file](ramls/saml-login.raml)

### Environment variables

`TRUST_ALL_CERTIFICATES`: if value is `true` then HTTPS certificates not checked. This is a security issue in
production environment, use it for testing only! Default value is `false`.
`TRUST_ALL_CERTIFICATES`: if value is `true` then HTTPS certificates not checked. This is a security issue in production environment, use it for testing only! Default value is `false`.

`LOGIN_COOKIE_SAMESITE`: Configures the SameSite attribute of the login token cookies. Defaults to `Lax` if not set. If served from the same host name `Lax` allows deep links from other sites, for example from a wiki or webmail to an inventory instance record, whereas `Strict` doesn't allow them.

### Sample users for samltest.id

Expand All @@ -60,9 +61,17 @@ Refer to the user documentation [Guide](GUIDE.md).
For upgrading see [NEWS](NEWS.md) or
[Releases](https://github.com/folio-org/mod-login-saml/releases).

This module is based on the [https://www.pac4j.org/](PAC4J) library, more
authentication methods supported by PAC4J can be added to this module if
needed.
This module is based on the [https://www.pac4j.org/](PAC4J) library
and supports SAML Single Sign On (SSO) including federations like
[https://edugain.org/](eduGAIN).

More mechanisms supported by PAC4J can be added to this module if needed:

Authentication mechanisms: OAuth (Facebook, Twitter, Google...) - CAS -
OpenID Connect - HTTP - Google App Engine - LDAP - SQL - JWT - MongoDB -
CouchDB - IP address - Kerberos (SPNEGO) - REST API.

Authorization mechanisms: Roles/permissions.

Other [modules](https://dev.folio.org/source-code/#server-side) are described,
with further FOLIO Developer documentation at
Expand Down
21 changes: 19 additions & 2 deletions descriptors/ModuleDescriptor-template.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
"provides": [
{
"id": "login-saml",
"version": "2.0",
"version": "2.1",
"handlers": [
{
"methods": [
Expand All @@ -30,6 +30,19 @@
"users.collection.get"
]
},
{
"methods": [
"POST"
],
"pathPattern": "/saml/callback-with-expiry",
"permissionsRequired": [],
"delegateCORS": true,
"modulePermissions": [
"auth.signtoken",
"configuration.entries.collection.get",
"users.collection.get"
]
},
{
"methods": [
"GET"
Expand Down Expand Up @@ -123,7 +136,11 @@
"requires": [
{
"id": "authtoken",
"version": "1.0 2.0"
"version": "2.0"
},
{
"id": "authtoken2",
"version": "1.0"
},
{
"id": "users",
Expand Down
Loading

0 comments on commit 6d37057

Please sign in to comment.