Skip to content

doc authenticator #154

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 8 commits into from
Oct 7, 2022
Merged
Show file tree
Hide file tree
Changes from 4 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
3 changes: 3 additions & 0 deletions AuthenticationExample/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# Authentication Example App

This is an application that shows how to use the Authenticator toolkit component to fully support ArcGIS authentication and network authentication in an application.
47 changes: 47 additions & 0 deletions Documentation/Authenticator/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
# Authenticator

Displays user interface when network and ArcGIS authentication challenges occur.

## Features

The Authenticator is a view modifier that will cause a prompt when the Authenticator is asked to handle an authentication challenge. This will handle many different types of authentication, for example:
- ArcGIS authentication (token and OAuth)
- Integrated Windows Authentication (IWA)
- Client Certificate (PKI)

The Authenticator can be configured to support securely persisting credentials to the keychain.

## Behavior:

The Authenticator view modifier will display an alert or a full screen modal view to prompt the user for credentials.

## Usage

```swift
init() {
// Create an authenticator.
authenticator = Authenticator(
// If you want to use OAuth, uncomment this code:
//oAuthConfigurations: [.arcgisDotCom]
)
// Set the challenge handler to be the authenticator we just created.
ArcGISRuntimeEnvironment.authenticationChallengeHandler = authenticator
}

var body: some SwiftUI.Scene {
WindowGroup {
HomeView()
.authenticator(authenticator)
.task {
// Here we make the authenticator persistent, which means that it will synchronize
// with they keychain for storing credentials.
// It also means that a user can sign in without having to be prompted for
// credentials. Once credentials are cleared from the stores ("sign-out"),
// then the user will need to be prompted once again.
try? await authenticator.setupPersistentCredentialStorage(access: .whenUnlockedThisDeviceOnly)
}
}
}
```

To see the `Authenticator` in action, check out the [Authentication Examples](../../AuthenticationExample) and refer to [AuthenticationApp.swift](../../AuthenticationExample/AuthenticationExample/AuthenticationApp.swift) in the project.
1 change: 1 addition & 0 deletions Documentation/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,3 +9,4 @@
* **[Scalebar](Scalebar)** - Displays current scale reference.
* **[Search](Search)** - Displays a search experience for geo views.
* **[UtilityNetworkTrace](UtilityNetworkTrace)** - Runs traces on a web map published with a utility network and trace configurations.
* **[Authenticator](Documentation/Authenticator)** - Displays user interface when network and ArcGIS authentication challenges occur.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ To use Toolkit in your project:
* **[Scalebar](Documentation/Scalebar)** - Displays current scale reference.
* **[Search](Documentation/Search)** - Displays a search experience for geo views.
* **[UtilityNetworkTrace](Documentation/UtilityNetworkTrace)** - Runs traces on a web map published with a utility network and trace configurations.
* **[Authenticator](Documentation/Authenticator)** - Displays user interface when network and ArcGIS authentication challenges occur.


## Requirements
Expand Down