Skip to content

Commit

Permalink
docs: update default authn method document (#8684)
Browse files Browse the repository at this point in the history
Documents in the `configuration guide` section should follow the same logical grouping as in the TUI

Signed-off-by: ossdhaval <343411+ossdhaval@users.noreply.github.com>
  • Loading branch information
ossdhaval committed Jun 11, 2024
1 parent 304851f commit 77a8a62
Show file tree
Hide file tree
Showing 2 changed files with 100 additions and 33 deletions.
133 changes: 100 additions & 33 deletions docs/admin/config-guide/default-authentication-method-config.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,77 +2,144 @@
tags:
- administration
- configuration
- authentication
- default authentication
---

# Default Authentication Method

> Prerequisite: Know how to use the Janssen CLI in [command-line mode](config-tools/jans-cli/README.md)
The Janssen Server allows administrators to set and manage the default
authentication method for the authentication server.
The Janssen Server provides multiple configuration tools to perform these tasks.

Let's get the information of **Default Authentication Method**:
=== "Use Command-line"

```
Use the command line to perform actions from the terminal. Learn how to
use Jans CLI [here](./config-tools/jans-cli/README.md) or jump straight to
the [Using Command Line](#using-command-line)

=== "Use Text-based UI"

Use a fully functional text-based user interface from the terminal.
Learn how to use Jans Text-based UI (TUI)
[here](./config-tools/jans-tui/README.md) or jump straight to the
[Using Text-based UI](#using-text-based-ui)

=== "Use REST API"

Use REST API for programmatic access or invoke via tools like CURL or
Postman. Learn how to use Janssen Server Config API
[here](./config-tools/config-api/README.md) or Jump straight to the
[Using Configuration REST API](#using-configuration-rest-api)

## Using Command Line

Operations to manage the default authentication method are grouped under the
`DefaultAuthenticationMethod` task. To get information about those operations
use the command below.

```bash title="Command"
/opt/jans/jans-cli/config-cli.py --info DefaultAuthenticationMethod
```
```
```text title="Output"
Operation ID: get-acrs
Description: Gets default authentication method.
Operation ID: put-acrs
Description: Updates default authentication method.
Schema: /components/schemas/AuthenticationMethod
Schema: AuthenticationMethod
To get sample shema type /opt/jans/jans-cli/config-cli.py --schema <schma>, for example /opt/jans/jans-cli/config-cli.py --schema /components/schemas/AuthenticationMethod
To get sample schema type /opt/jans/jans-cli/config-cli.py --schema <schma>, for example /opt/jans/jans-cli/config-cli.py --schema /components/schemas/AuthenticationMethod
```

Table of Contents
=================
### Find Current Authentication Method

* [Default AUthentication Method](#default-authentication-method)
* [Find Current Authentication Method](#find-current-authentication-method)
* [Update Default Authentication Method](#update-default-authentication-method)

## Find Current Authentication Method

To get the default authentication method:
```
To get the current default authentication method use the command below.
```bash title="Command"
/opt/jans/jans-cli/config-cli.py --operation-id get-acrs
```
```
Getting access token for scope https://jans.io/oauth/config/acrs.readonly
```json title="Sample Output"
{
"defaultAcr": "simple_password_auth"
}
```

## Update Default Authentication Method
### Update Default Authentication Method

Let's update the _Default Authentication Method_ using janssen CLI command line. To perform the _put-acrs_ operation, we have to use its schema.
Let's update the _Default Authentication Method_ using the janssen CLI command line.
To perform the _put-acrs_ operation, we have to use its schema.
To get its schema:

```bash title="Command"
/opt/jans/jans-cli/config-cli.py --schema AuthenticationMethod \
> /tmp/patch-default-auth.json
```
/opt/jans/jans-cli/config-cli.py --schema AuthenticationMethod > /tmp/patch-default-auth.json
```
```json title="Sample Output"
{
"defaultAcr": "string"
}

```

This command will create a `.json` file with a schema.
It comes with a `string` value. We need to modify this file.
We have seen that our default authentication method is `simple_password_auth`.
We are going to update it with `passport_saml` authentication method.

```json title="Sample Output"
{
"defaultAcr": null
"defaultAcr": "passport_saml"
}

```

It will create a `.json` file with a schema. It comes with a `null` value. We need to modify this file to update default acr.
we have seen that our Default Authentication Method is `simple_password_auth`. We are going to update it with `passport_saml` authenitcation method.
Now let's trigger the operation using the above file.

```bash title="Command"
/opt/jans/jans-cli/config-cli.py --operation-id put-acrs \
--data /tmp/patch-default-auth.json
```
nano /tmp/patch-default-auth.json

It will show the updated result.

```json title="Sample Output"
Server Response:
{
"defaultAcr": "passport_saml"
}

```

![update default authentication method](../../assets/image-cl-update-default-auth-03042021.png)
## Using Text-based UI

In Janssen, You can manage default authentication method using
the [Text-Based UI](./config-tools/jans-tui/README.md) also.

You can start TUI using the command below:

Now let's do the operation:
```commandline
/opt/jans/jans-cli/config-cli.py --operation-id put-acrs --data /tmp/patch-default-auth.json
```bash title="Command"
sudo /opt/jans/jans-cli/jans_cli_tui.py
```

It will show the updated result.
### Find Current Authentication Method

Navigate to `Auth Server` -> `Authn` to open the `Authn` screen as shown
in the image below. This screen lists the available authentication methods
where the default method is marked with `x` under the `Default` column.

![image](../../assets/tui-curr-authn-method.png)


### Update Default Authentication Method

![image](../../assets/tui-authn-method-detail.png)

Bring the tab focus to the authentication method that should be the new default
method. Hit `Enter` to open the dialog as shown above. Using the checkbox for
`Default Authen Method` the current method can be made the default
authentication method.


![updated result](../../assets/image-cl-update-default-auth-result-03042021.png)
## Using Configuration REST API

Janssen Server Configuration REST API exposes relevant endpoints for managing
and configuring the Default Authentication Method. Endpoint details are published
in the [Swagger document](./../reference/openapi.md).
Binary file added docs/assets/tui-curr-authn-method.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit 77a8a62

Please sign in to comment.