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
17 changes: 17 additions & 0 deletions packages/@okta/vuepress-site/.vuepress/config.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
const guidesInfo = require('./scripts/build-guides-info');
const codeInfo = require('./scripts/build-code-info');
const overviewPages = require('./scripts/build-overview-pages');
const findLatestWidgetVersion = require('./scripts/findLatestWidgetVersion');
const convertReplacementStrings = require('./scripts/convert-replacement-strings');
Expand Down Expand Up @@ -385,6 +386,7 @@ module.exports = ctx => ({

additionalPages: [
...guidesInfo.additionalPagesForGuides(),
...codeInfo.additionalPagesForCode(),
...overviewPages()
],

Expand All @@ -402,6 +404,7 @@ module.exports = ctx => ({

// add redir url for main guide pages
let found = guidesInfo.guideInfo[path];
let foundCode = codeInfo.codeInfo[path];

if (path.startsWith('/docs/reference/api/')) {
frontmatter.sitemap = {
Expand Down Expand Up @@ -480,6 +483,17 @@ module.exports = ctx => ({
};
}

if(foundCode && foundCode.page && foundCode.sections) {
if(foundCode.mainFramework) {
$page.redir = `/code/${foundCode.page}/${foundCode.mainFramework}/${foundCode.sections[0]}/`
} else {
$page.redir = `/code/${foundCode.page}/${foundCode.sections[0]}/`
}
frontmatter.sitemap = {
exclude: true
};
}

if(!frontmatter.canonicalUrl) {
frontmatter.canonicalUrl = `https://developer.okta.com${path}`;
}
Expand Down Expand Up @@ -509,6 +523,9 @@ module.exports = ctx => ({
if(found && !found.guide && !found.sections && found.mainFramework) {
$page.hasStackContent = true
}
if(foundCode && !foundCode.page && !foundCode.sections && foundCode.mainFramework) {
$page.hasStackContent = true
}
},
async ready() {
if (process.env.DEPLOY_ENV && process.env.DEPLOY_ENV === 'test') {
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,82 @@
const fs = require('fs');
const yaml = require('js-yaml');
const path = require('path');

const CODE_ROOT = 'code';

const getFrontMatterFrom = text => text.replace(/.*^---\s/m, '').replace(/^---[\s\S]*/m, '');
const getMetaFor = filePath => yaml.safeLoad(getFrontMatterFrom(fs.readFileSync(`${filePath}/index.md`, { encoding: 'utf8' })));

const getFrameworksFor = dirPath => {
const entries = fs.readdirSync(dirPath);
return entries
.filter(name => !name.includes('.')) // assume: no ext = dir, for more simple code
.sort((a, b) => a.localeCompare(b, 'en', { 'sensitivity': 'base' }));
};

const codeInfo = {};

// Load frontmatter yaml to JS from root file index page
const allCodeMeta = getMetaFor(CODE_ROOT);
// Use stackSelectorPagesInCode instead of guides
const codePages = allCodeMeta.stackSelectorPagesInCode || [];
codePages.forEach(page => {
// Load frontmatter yaml to JS from _those_ pages index pages
const pageMeta = getMetaFor(`${CODE_ROOT}/${page}`);
pageMeta.page = page;
codeInfo[`/${CODE_ROOT}/${page}/`] = { ...pageMeta };

if (pageMeta.sections) {
pageMeta.sections.forEach(section => {
// load frontmatter yaml to JS for the index page of the sections of this page
const sectionMeta = getMetaFor(`${CODE_ROOT}/${page}/${section}`);
// get all the directories under this section, count them each as a framework
const frameworks = getFrameworksFor(`${CODE_ROOT}/${page}/${section}`);
if (!pageMeta.frameworks && frameworks.length) {
pageMeta.frameworks = frameworks;
pageMeta.mainFramework = pageMeta.mainFramework || frameworks[0];
} else if (pageMeta.frameworks && frameworks.length) {
pageMeta.frameworks = Array.from(new Set([...pageMeta.frameworks, ...frameworks]));
}
});
}

pageMeta.frameworks = pageMeta.frameworks || [];

if (pageMeta.sections) {
pageMeta.sections.forEach(section => {
const sectionMeta = getMetaFor(`${CODE_ROOT}/${page}/${section}`);
[...pageMeta.frameworks, '-'].forEach(framework => {
codeInfo[`/${CODE_ROOT}/${page}/${framework}/${section}/`] = {
...sectionMeta,
sectionTitle: sectionMeta.title,
pageTitle: pageMeta.title,
title: `${sectionMeta.title} - ${pageMeta.title}`,
toAdd: true,
mainFramework: pageMeta.mainFramework,
filePath: path.resolve(__dirname, `../../${CODE_ROOT}/${page}/${section}/index.md`)
};
});
});
}

codeInfo[`/${CODE_ROOT}/${page}/`] = { ...pageMeta };
});

const additionalPagesForCode = () => {
const obj = Object.entries(codeInfo)
.filter(([, info]) => info.toAdd)
.map(([path, info]) => ({
...info,
path,
content: ' ',
}))
.sort((a, b) => a.path > b.path ? 1 : a.path < b.path ? -1 : 0);

return obj;
};

module.exports = {
codeInfo,
additionalPagesForCode,
};
2 changes: 2 additions & 0 deletions packages/@okta/vuepress-site/code/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@ meta:
- name: description
content: Okta maintains the following recommended SDKs for developers.
excerpt: Okta maintains the following recommended SDKs for developers.
stackSelectorPagesInCode:
- oie-embedded-common-download-setup-app
---

<style>
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
---
title: Download and set up the SDK, Sign-In Widget, and sample apps
excerpt: Download and set up the SDK, Sign-In Widget, and sample apps
layout: Guides
sections:
- main
---
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
Update the key/value pairs in the `okta.properties` file found in the `okta-idx-android` project root directory.

1. Open the `okta-idx-android` project in Android Studio.
2. Locate and open the `okta.properties` file in the project root directory, which is a property file that stores the name and value for each configuration setting.
3. Add the following values and close the file when you finish:

```json
issuer=https://example.okta.com/oauth2/default
clientId=clientID_from_client_app
redirectUri=com.okta.sample.android:/login
```
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
After you satisfy the software requirements, clone the [okta-idx-android](https://github.com/okta/okta-idx-android)
repository to your local directory.

The Identity Engine Android SDK project consists of the `okta-idx-android/app` directory that contains the files for the embedded authentication with the SDK app sample. Run the sample app after you [set the configuration values](#set-the-configuration-values).
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Use a redirect URI that is appropriate for your app or `com.okta.sample.android:/login` if you're using the sample app.
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
[Identity Engine Android SDK (okta-idx-android)](https://github.com/okta/okta-idx-android)
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
Follow these steps to integrate the SDK into your own app.

<EmbeddedBrowserWarning />

#### 1: Set up your app with the prerequisites

1. In your Okta Org, [create a new application integration](/docs/guides/oie-embedded-common-org-setup/android/main/#create-a-new-application) for your app.
1. Ensure that you have all the [software requirements](#software-requirements).

#### 2: Import the packages and add the Android framework

The embedded authentication with SDK sample apps use the Android framework with the Identity Engine Java SDK. Import the Okta API packages as well as any Android packages that you need.

```java
package com.okta.android.example;

import com.okta.idx.sdk.api.client.IDXAuthenticationWrapper;
import com.okta.idx.sdk.api.client.ProceedContext;
import com.okta.idx.sdk.api.model.AuthenticationOptions;
import com.okta.idx.sdk.api.model.UserProfile;
import com.okta.idx.sdk.api.model.VerifyAuthenticatorOptions;
import com.okta.idx.sdk.api.response.AuthenticationResponse;
import com.okta.idx.sdk.api.response.TokenResponse;
```

#### 3: Instantiate the IDXAuthenticationWrapper object

Start integrating your app using the Identity Engine Java SDK. Begin the Okta authentication flow by instantiating the `IDXAuthenticationWrapper` object.

```java
AuthenticationResponse beginResponse = idxAuthenticationWrapper.begin()
```

See [IDX Kotlin SDK Documentation](https://github.com/okta/okta-idx-android#idx-kotlin-sdk-documentation) for more information.

Before running your app, ensure that you [set the configuration values](#set-the-configuration-values) for your embedded app. See [Run the embedded SDK sample app](/docs/guides/oie-embedded-common-run-samples/android/main/#run-the-embedded-sdk-sample-app) for step-by-step instructions on how to run a sample Android app.
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
* [Android Studio](https://developer.android.com/studio) 4.2.x or later
* [JDK 8](https://www.oracle.com/java/technologies/javase/javase-jdk8-downloads.html) or later

Include the following Identity Engine Java SDK dependency for Apache Maven:

```groovy
implementation 'com.okta.idx.sdk: okta-idx-java-api:$okta_sdk_version'
```

where `$okta.sdk.version` is the latest release version. See [Release Status](https://github.com/okta/okta-idx-java#release-status) for the latest Identity Engine Java SDK version.

The Okta Identity Engine Android sample app uses the Identity Engine Java SDK. The Java SDK isn't Android-specific, but works with Android.
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
> **Note:** The embedded Sign-In Widget is not applicable for Android.
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
#### Client secret

For the sample app, use the **Client secret** for the application that you created in
[Create a new application](/docs/guides/oie-embedded-common-org-setup/aspnet/main/#create-a-new-application).
To find this value, go to **Applications** > **Applications** in the Admin Console.
Select your app, and then on the **General** tab copy the **Client secret**.
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
You have several options for setting the configuration values in your app.

### Option 1: Create a configuration file

Create a YAML file named `okta.yaml` in one of the following directories:

* Current user's home directory
* **Unix/Linux**: `~/.okta/okta.yaml`
* **Windows**: `%userprofile%\.okta\okta.yaml`

* Application or project's root directory

> **Note:** If you're using the recommended **IISExpress** debugger in Visual Studio to run your app, the `okta.yaml` file needs to be in the following location: `{IIS Express install location}\IIS Express`, for example, `C:\Program Files (x86)\IIS Express\okta.yaml`.

The following is the required content format for the YAML file:

```yaml
okta:
idx:
issuer: "https://{yourOktaDomain}/oauth2/default"
clientId: "{clientId}"
clientSecret: "{clientSecret}"
scopes:
- "{scope1}"
- "{scope2}"
redirectUri: "{redirectUri}"
```

### Option 2: Set the values as environment variables

Set the following environment variables with the configuration values:

* `OKTA_IDX_ISSUER`
* `OKTA_IDX_CLIENTID`
* `OKTA_IDX_CLIENTSECRET`
* `OKTA_IDX_REDIRECTURI`
* `OKTA_IDX_SCOPES`

### Option 3: Add the values as parameters to the SDK's client constructor

Add the values as parameters to the constructor for the `IdxClient`.

```csharp
var client = new IdxClient(new IdxConfiguration()
{
Issuer = "{YOUR_ISSUER}",
ClientId = "{YOUR_CLIENT_ID}",
ClientSecret = "{YOUR_CLIENT_SECRET}",
RedirectUri = "{YOUR_REDIRECT_URI}",
Scopes = new List<string>{"openid","profile", "offline_access"}
});
```

> **Note:** The sample app uses dependency injection to instantiate the `IdxClient`,
so the constructor code is located in the `UnityConfig.cs` file.
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
## Order of the configuration options

When multiple configurations options are used simultaneously, the SDK selects the configuration to use based on the following order:

1. SDK Client constructor
2. Environment variables
3. Configuration

For example, values set in the SDK Client constructor override the
environment variables and configuration file settings. Subsequently,
the environment variables take precedence over the configuration file.

> **Note:** To avoid confusion as to which configuration values that are used by the SDK, you should use only one configuration option in your solution.
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
After you satisfy the software requirements, clone the [okta-idx-dotnet](https://github.com/okta/okta-idx-dotnet)
repository to your local directory.

The source code for the sample app and the SDK is located in the following repository folder: `.../okta-idx-dotnet/src`. Under the `src` folder, the project structure consists of the following:

* `okta-idx-dotnet/src` &mdash; SDK source, unit tests, and integration tests
* `okta-idx-dotnet/samples` &mdash; samples directory
* `okta-idx-dotnet/samples/samples-aspnet/embedded-auth-with-sdk` &mdash; embedded SDK sample
* `okta-idx-dotnet/samples/samples-aspnet/embedded-sign-in-widget` &mdash; embedded Sign-In Widget sample
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Use a redirect URI that is appropriate for your app or `https://localhost:44314/interactioncode/callback` if you're using the sample app.
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
[Identity Engine ASP.NET SDK (okta-idx-dotnet)](https://github.com/okta/okta-idx-dotnet)
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
> **Note:** Try to [run the embedded SDK sample app](/docs/guides/oie-embedded-common-run-samples/aspnet/main/#run-the-embedded-sdk-sample-app) and explore the available [embedded authentication use cases](/docs/guides/oie-embedded-sdk-use-case-basic-sign-in/aspnet/main/) to get familiar with the SDK before you start to integrate your own embedded .NET app.

Begin to integrate the SDK into your own app by following these steps:

#### 1: Set up your app for .Net 4.8 or greater

The SDK and sample apps are built using .Net 4.8.

#### 2: Add the Okta SDK Nuget packages

Before using the SDK in your own app, you need to add the following
Nuget packages to your project:

* `Okta.Idx.Sdk`
* `Okta.Sdk.Abstractions`

> **Note:** Nuget packages are pre-release. When you search for Nuget
packages in Visual Studio, ensure that the pre-release check box is selected.

#### 3: Initialize the IdxClient object

All functionality in the SDK is accessed through the methods of the
`IdxClient` object. After you add the Nuget packages, the next step
is to initialize the `IdxClient`. There are two steps to initialize the client:

1. Add the following namespaces:
* `Okta.Idx.Sdk`
* `Okta.Sdk.Abstractions`
1. Initialize the `IdxClient`.

See the following sample code for more details:

```csharp
using Okta.Idx.Sdk;
using Okta.Sdk.Abstractions;

var idxAuthClient = new IdxClient();
```

> **Note:** You can pass configuration values into the object's constructor. See [Option 3: Add the values as parameters to the SDK's client constructor](#option-3-add-the-values-as-parameters-to-the-sdk-s-client-constructor).
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
* Windows 10+ (Lower Windows versions may work but haven't been tested.)
* Visual Studio 2019 (Using IISExpress as the web server)
* .NET Framework 4.8 or higher
Loading