Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
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
6 changes: 3 additions & 3 deletions .github/workflows/docker-publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ jobs:
- run: |
npm install

IMAGE_PATH=boxyhq/mock-saml
IMAGE_PATH=quinnofficial/mock-saml-x
echo "IMAGE_PATH=${IMAGE_PATH}" >> $GITHUB_OUTPUT
MOCK_SAML_VERSION=$(echo $(cat ./package.json) | ./node_modules/json/lib/json.js version)
echo "NPMVERSION=$(echo ${MOCK_SAML_VERSION})" >> $GITHUB_OUTPUT
Expand All @@ -47,7 +47,7 @@ jobs:
uses: docker/setup-buildx-action@v4

- name: Login to Docker Hub
if: github.ref == 'refs/heads/release'
if: github.ref == 'refs/heads/main' || github.ref == 'refs/heads/release' || startsWith(github.ref, 'refs/tags/')
uses: docker/login-action@v4
with:
username: ${{ secrets.DOCKER_HUB_USERNAME }}
Expand All @@ -60,7 +60,7 @@ jobs:
context: ./
file: ./Dockerfile
platforms: linux/amd64,linux/arm64
push: ${{ github.ref == 'refs/heads/release' }}
push: ${{ github.ref == 'refs/heads/main' || github.ref == 'refs/heads/release' || startsWith(github.ref, 'refs/tags/') }}
tags: ${{ steps.npmversion.outputs.IMAGE_PATH }}:latest,${{ steps.npmversion.outputs.IMAGE_PATH }}:${{ steps.slug.outputs.SHA7 }},${{ steps.npmversion.outputs.IMAGE_PATH }}:${{ steps.npmversion.outputs.NPMVERSION }}

- name: Image digest
Expand Down
30 changes: 25 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,9 @@ Try [Mock SAML](https://mocksaml.com/), our free hosted service. Whilst we use t

### With Docker

The docker container can be found at [boxyhq/mock-saml](https://hub.docker.com/r/boxyhq/mock-saml).
The docker container can be found at [quinnofficial/mock-saml-x](https://hub.docker.com/r/quinnofficial/mock-saml-x).

#### Option 1: Passing environment variables via command line

```bash
docker run \
Expand All @@ -22,21 +24,39 @@ docker run \
-e ENTITY_ID="https://saml.example.com/entityid" \
-e PUBLIC_KEY="<PUBLIC_KEY>" \
-e PRIVATE_KEY="<PRIVATE_KEY>" \
-d boxyhq/mock-saml
-d quinnofficial/mock-saml-x
```

Refer to [env.example](https://github.com/boxyhq/mock-saml/blob/main/.env.example#L5C3-L5C97) for instructions on how to create the key pair.
Refer to [env.example](https://github.com/quinnrunsystem/mocksaml/blob/main/.env.example#L5) for instructions on how to create the key pair.
Replace `<PUBLIC_KEY>` with Base64 encoded value of public key.
Replace `<PRIVATE_KEY>` with Base64 encoded value of private key.

#### Option 2: Using a `.env` file

To avoid errors or shell parsing issues with multiline keys (like public/private keys) in command arguments, you can configure your environment variables in a `.env` file:

```bash
cp .env.example .env
# Edit .env and configure the variables (APP_URL, ENTITY_ID, PUBLIC_KEY, PRIVATE_KEY)
```

Then run the container referencing the `.env` file:

```bash
docker run \
-p 4000:4000 \
--env-file .env \
-d quinnofficial/mock-saml-x
```

### Without Docker

```
git clone https://github.com/boxyhq/mock-saml.git
git clone https://github.com/quinnrunsystem/mocksaml.git
```

```
cd mock-saml
cd mocksaml
```

Install dependencies
Expand Down
6 changes: 3 additions & 3 deletions pages/api/saml/auth.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,9 @@ export default async function handler(req: NextApiRequest, res: NextApiResponse)
if (req.method === 'POST') {
const { email, audience, acsUrl, id, relayState } = req.body;

if (!email.endsWith('@example.com') && !email.endsWith('@example.org')) {
res.status(403).send(`${email} denied access`);
}
// if (!email.endsWith('@example.com') && !email.endsWith('@example.org')) {
// res.status(403).send(`${email} denied access`);
// }

const userId = createHash('sha256').update(email).digest('hex');
const userName = email.split('@')[0];
Expand Down
12 changes: 5 additions & 7 deletions pages/saml/login.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,9 @@ export default function Login() {
const authUrl = namespace ? `/api/namespace/${namespace}/saml/auth` : '/api/saml/auth';
const [state, setState] = useState({
username: 'jackson',
domain: 'example.com',
acsUrl: 'https://sso.eu.boxyhq.com/api/oauth/saml',
audience: 'https://saml.boxyhq.com',
domain: 'runsystem.net',
acsUrl: 'http://localhost:3333/auth/saml/acs',
audience: 'jackson',
});

const acsUrlInp = useRef<HTMLInputElement>(null);
Expand Down Expand Up @@ -135,8 +135,7 @@ export default function Login() {
value={state.domain}
onChange={handleChange}
className='w-full rounded-md border border-gray-300 px-3 py-2 text-sm focus:border-primary focus:ring-2 focus:ring-primary/30'>
<option value='example.com'>@example.com</option>
<option value='example.org'>@example.org</option>
<option value='runsystem.net'>@runsystem.net</option>
</select>
</div>

Expand Down Expand Up @@ -165,8 +164,7 @@ export default function Login() {
<div className='rounded-md border border-blue-200 bg-blue-50 p-4'>
<p className='text-sm text-blue-900'>
This is a simulated login screen. You may choose any username, but only the domains{' '}
<code className='font-mono'>example.com</code> and{' '}
<code className='font-mono'>example.org</code> are allowed.
<code className='font-mono'>runsystem.net</code> and{' '}
</p>
</div>
</div>
Expand Down