Skip to content

Commit

Permalink
Merge pull request wso2#4590 from himeshsiriwardana/ana-minor-fixes
Browse files Browse the repository at this point in the history
Made improvements to the app-native authentication docs
  • Loading branch information
himeshsiriwardana authored May 15, 2024
2 parents 19fc7d7 + 0f4b202 commit e3d229b
Show file tree
Hide file tree
Showing 14 changed files with 228 additions and 211 deletions.
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{% set api_base_path = "https://api.asgardeo.io/t/{organization_name}/oauth2/authorize/" %}
{% set api_example_base_path = "https://api.asgardeo.io/t/bifrost/oauth2/authorize/" %}

{% include "../../../../includes/guides/authentication/add-app-native-authentication.md" %}
{% include "../../../../../includes/guides/authentication/app-native-authentication/add-app-native-authentication.md" %}
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{% set api_base_path = "https://api.asgardeo.io/t/{organization_name}/oauth2/authorize/" %}
{% set api_example_base_path = "https://api.asgardeo.io/t/bifrost/oauth2/authorize/" %}

{% include "../../../../../includes/guides/authentication/app-native-authentication/configure-advanced-app-native-settings.md" %}

4 changes: 3 additions & 1 deletion en/asgardeo/mkdocs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -200,7 +200,9 @@ nav:
- MFA based on advanced conditions (using WSO2 Choreo): guides/authentication/conditional-auth/add-authentications-based-on-api-calls.md
- Add passkey progressive enrollment: guides/authentication/conditional-auth/passkey-progressive-enrollment-based-template.md
- Write a custom authentication script: guides/authentication/conditional-auth/write-your-first-script.md
- Add app-native authentication: guides/authentication/add-app-native-authentication.md
- App-native authentication:
- Add app-native authentication: guides/authentication/app-native-authentication/add-app-native-authentication.md
- Configure advanced app-native settings: guides/authentication/app-native-authentication/configure-advanced-app-native-settings.md
- Login Flow AI: guides/authentication/ai-loginflow.md
- Configure OIDC flows:
- Configure OIDC flows: guides/authentication/oidc/index.md
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
{% set api_base_path = "https://localhost:9443/oauth2/authorize/" %}
{% set api_example_base_path = "https://localhost:9443/oauth2/authorize/" %}
{% include "../../../../../includes/guides/authentication/add-app-native-authentication.md" %}
{% include "../../../../../../includes/guides/authentication/app-native-authentication/add-app-native-authentication.md" %}
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{% set api_base_path = "https://localhost:9443/oauth2/authorize/" %}
{% set api_example_base_path = "https://localhost:9443/oauth2/authorize/" %}
{% include "../../../../../../includes/guides/authentication/app-native-authentication/configure-advanced-app-native-settings.md" %}
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{% include "../../../../../../includes/guides/authentication/app-native-authentication/index.md" %}
10 changes: 7 additions & 3 deletions en/identity-server/7.0.0/mkdocs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -46,8 +46,9 @@ plugins:
'guides/authentication/enterprise-login/index.md': 'guides/authentication/standard-based-login/index.md'
'guides/authentication/enterprise-login/add-oidc-idp-login.md': 'guides/authentication/standard-based-login/add-oidc-idp-login.md'
'guides/authentication/enterprise-login/add-saml-idp-login.md': 'guides/authentication/standard-based-login/add-saml-idp-login.md'
'guides/request-path-auth/request-paths-overview.md': 'guides/authentication/add-app-native-authentication.md'
'guides/request-path-auth/oauth-request-path.md': 'guides/authentication/add-app-native-authentication.md'
'guides/request-path-auth/request-paths-overview.md': 'guides/authentication/app-native-authentication/add-app-native-authentication.md'
'guides/request-path-auth/oauth-request-path.md': 'guides/authentication/app-native-authentication/add-app-native-authentication.md'
'guides/authentication/add-application-native-login.md': 'guides/authentication/app-native-authentication/add-app-native-authentication.md'
'guides/passwordless/overview.md': 'guides/authentication/passwordless-login.md'
'guides/passwordless/magic-link.md': 'guides/authentication/passwordless-login/add-passwordless-login-with-magic-link.md'
'guides/passwordless/fido.md': 'guides/authentication/passwordless-login/add-passwordless-login-with-passkey.md'
Expand Down Expand Up @@ -414,7 +415,10 @@ nav:
- Add passkey progressive enrollment: guides/authentication/conditional-auth/passkey-progressive-enrollment-based-template.md
- Write a custom authentication script: guides/authentication/conditional-auth/write-your-first-script.md
- Configure multi-attribute login: guides/authentication/multi-attribute-login.md
- Add app-native authentication: guides/authentication/add-app-native-authentication.md
- App-native authentication:
- App-native authentication: guides/authentication/app-native-authentication/index.md
- Add app-native authentication: guides/authentication/app-native-authentication/add-app-native-authentication.md
- Configure advanced app-native settings: guides/authentication/app-native-authentication/configure-advanced-app-native-settings.md
- Configure OIDC flows:
- Configure OIDC flows: guides/authentication/oidc/index.md
- Discover OIDC endpoints: guides/authentication/oidc/discover-oidc-configs.md
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
{% set api_base_path = "https://localhost:9443/oauth2/authorize/" %}
{% set api_example_base_path = "https://localhost:9443/oauth2/authorize/" %}
{% include "../../../../../includes/guides/authentication/add-app-native-authentication.md" %}
{% include "../../../../../../includes/guides/authentication/app-native-authentication/add-app-native-authentication.md" %}
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{% set api_base_path = "https://localhost:9443/oauth2/authorize/" %}
{% set api_example_base_path = "https://localhost:9443/oauth2/authorize/" %}
{% include "../../../../../../includes/guides/authentication/app-native-authentication/configure-advanced-app-native-settings.md" %}
9 changes: 6 additions & 3 deletions en/identity-server/next/mkdocs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -46,8 +46,9 @@ plugins:
'guides/authentication/enterprise-login/index.md': 'guides/authentication/standard-based-login/index.md'
'guides/authentication/enterprise-login/add-oidc-idp-login.md': 'guides/authentication/standard-based-login/add-oidc-idp-login.md'
'guides/authentication/enterprise-login/add-saml-idp-login.md': 'guides/authentication/standard-based-login/add-saml-idp-login.md'
'guides/request-path-auth/request-paths-overview.md': 'guides/authentication/add-app-native-authentication.md'
'guides/request-path-auth/oauth-request-path.md': 'guides/authentication/add-app-native-authentication.md'
'guides/request-path-auth/request-paths-overview.md': 'guides/authentication//app-native-authentication/add-app-native-authentication.md'
'guides/request-path-auth/oauth-request-path.md': 'guides/authentication/app-native-authentication/add-app-native-authentication.md'
'guides/authentication/add-application-native-login.md': 'guides/authentication/app-native-authentication/add-app-native-authentication.md'
'guides/passwordless/overview.md': 'guides/authentication/passwordless-login.md'
'guides/passwordless/magic-link.md': 'guides/authentication/passwordless-login/add-passwordless-login-with-magic-link.md'
'guides/passwordless/fido.md': 'guides/authentication/passwordless-login/add-passwordless-login-with-passkey.md'
Expand Down Expand Up @@ -414,7 +415,9 @@ nav:
- Add passkey progressive enrollment: guides/authentication/conditional-auth/passkey-progressive-enrollment-based-template.md
- Write a custom authentication script: guides/authentication/conditional-auth/write-your-first-script.md
- Configure multi-attribute login: guides/authentication/multi-attribute-login.md
- Add app-native authentication: guides/authentication/add-app-native-authentication.md
- App-native authentication:
- Add app-native authentication: guides/authentication/app-native-authentication/add-app-native-authentication.md
- Configure advanced app-native settings: guides/authentication/app-native-authentication/configure-advanced-app-native-settings.md
- Configure OIDC flows:
- Configure OIDC flows: guides/authentication/oidc/index.md
- Discover OIDC endpoints: guides/authentication/oidc/discover-oidc-configs.md
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,125 @@
# Add app-native authentication

In traditional applications, login is usually fulfilled by a web browser. This means that the users who attempt to log in to these applications will have to be redirected to a web browser for authentication. This is not ideal if your goal is to provide the user with a seamless login experience or if you have a business need to keep users within the application's environment.

App-Native Authentication takes an API-based approach to let developers implement a secure login experience directly within the application along with features such as Multi-Factor Authentication (MFA), adaptive authentication, and support for federated logins. With app-native authentication users will have a seamless login experience from right within the application without the need to be redirected elsewhere for login.


!!! warning "Limitations of App-Native Authentication"

- At the time of login, app-native authentication,

- does not prompt the user to provide missing mandatory attributes.
- does not prompt the user for consent to share attributes with the application.
- does not support prompts in adaptive authentication flows.
- does not facilitate enrolling authenticators (e.g. TOTP authenticator).

- App-native authentication does not support all authentication methods. If you have an unsupported option configured, the login flow will not be initiated.


## How it works

The following diagram illustrates the high-level steps involved with app-native authentication.

![app-native-authentication-sequence]({{base_path}}/assets/img/guides/app-native-authentication/app-native-authentication-sequence.png){: width="650" style="display: block; margin: 0; border: 0px;"}


1. User initiates a login request at the application's login page.
2. The application initiates an app-native authentication request with the server. The initial request made by the application is similar to an [OAuth 2.0 authorization code request]({{base_path}}/guides/authentication/oidc/implement-auth-code/) but with the `response_mode` set to `direct` as shown below.

=== "Sample request"

```java
curl --location '{{api_base_path}}'
--header 'Accept: application/json'
--header 'Content-Type: application/x-www-form-urlencoded'
--data-urlencode 'client_id=<client_id>'
--data-urlencode 'response_type=<response_type>'
--data-urlencode 'redirect_uri=<redircet_url>'
--data-urlencode 'state=<state>'
--data-urlencode 'scope=<space separated scopes>'
--data-urlencode 'response_mode=direct'
```

=== "Example"
```java
curl --location '{{api_example_base_path}}'
--header 'Accept: application/json'
--header 'Content-Type: application/x-www-form-urlencoded'
--data-urlencode 'client_id=VTs12Ie26wb8HebnWercWZiAhMMa'
--data-urlencode 'response_type=code'
--data-urlencode 'redirect_uri=https://example-app.com/redirect'
--data-urlencode 'state=logpg'
--data-urlencode 'scope=openid internal_login'
--data-urlencode 'response_mode=direct'
```

3. The server responds with instructions for the next step of the authentication.
4. The application displays the available authentication options to the user and prompts the user to enter the credentials.
5. User interacts with the application and enters the credentials for a selected authentication option.
6. The application gathers the credentials and sends an authentication request back to the server using the **Authentication API**.

!!! info
Steps 3-6 repeat for all authentication steps configured for the application.

!!! tip "What is the Authentication API?"
- The Authentication API is an interactive, stateful API that facilitates a multi-step authentication flow. See its [OpenAPI definition]({{base_path}}/apis/app-native-authentication-api/) for more details.
- While app-native authentication is initiated at the `/authorize` endpoint, the authentication API fulfills the actual authentication for each step by interacting with the `/authn` endpoint.

7. After the authentication is complete, the application receives an OAuth2 authorization code in the response.

!!! note "Learn more"
While this section provides a brief overview, it is highly recommended to read through [app-native authentication]({{base_path}}/references/app-native-authentication) to understand the concept in detail.


## Try it out
Follow the steps below to try out App-Native Authentication with {{product_name}}.

!!! warning "Attention"
App-native authentication should be limited exclusively to an organization's internal applications. AVOID using it with third-party applications to mitigate the risk of credential exposure.

### Prerequisites

- To get started, you need to [register an application with {{ product_name }}]({{base_path}}/guides/applications/).

- You need to have a user account in {{ product_name }}. If you don't already have one, [create a user account]({{base_path}}/guides/users/manage-users/#onboard-a-user) in {{ product_name }}.

### Enable App-Native Authentication

Follow the steps below to enable app-native authentication for your application.

1. On {{product_name}} Console, go to **Applications**.

2. Go to the **Protocol** tab and select **Code** from **Allowed grant types**.

3. Click **Update** to save the changes.

4. Go to the **Advanced** tab of your application and select **Enable app-native authentication API**.

![Enable app-native authentication]({{base_path}}/assets/img/guides/app-native-authentication/enable-app-native-authentication.png){: width="600" style="display: block; margin: 0; border: 0.3px solid lightgrey;"}

5. Click **Update** to save the changes.

6. Go to the **Login flow** tab and configure a login flow with the supported authentication options.

??? tip "Finding supported authentication options in the login flow"
Supported authentication options are tagged with `#APIAuth`.

![Supported authentication options]({{base_path}}/assets/img/guides/app-native-authentication/supported-authentication-options.png){: width="400" style="display: block; margin: 0;"}

7. Click **Update** to save the changes.

8. Try out App-Native Authentication using Postman.

{% if product_name=="Asgardeo"%}
[![Run in Postman](https://run.pstmn.io/button.svg)](https://app.getpostman.com/run-collection/8657284-83f51f64-fe45-4ca4-88b0-f670562d6b44){: target="#"}
{% else %}
[![Run in Postman](https://run.pstmn.io/button.svg)](https://app.getpostman.com/run-collection/8657284-8d164672-61aa-4326-bc5e-30314c49f6d0){: target="#"}
{% endif %}

!!! note
Learn more about the API calls in [App-native authentication]({{base_path}}/references/app-native-authentication/).

## What's next?

Go through [Add advanced app-native configurations]({{base_path}}/guides/authentication/app-native-authentication/configure-advanced-app-native-settings/) to learn about advanced features such as how to secure the authentication request and handle Single Sign-On (SSO) with app-native authentication.
Loading

0 comments on commit e3d229b

Please sign in to comment.