Authentication
Types related to the Authentication service.
-
A value containing information about an authenticated user.
To authenticate a user, one or more authentication methods are used.
See moreDeclaration
Swift
public struct AuthenticationDetails : AuthenticationProviderIdentity, Codable, Equatable, CustomStringConvertible, CustomDebugStringConvertible
extension AuthenticationDetails: WebcomCombinable
-
A value representing an event of the
See moreAuthenticationService
.Declaration
Swift
@frozen public enum AuthenticationEvent : Equatable, CustomStringConvertible, CustomDebugStringConvertible
-
A type representing an authentication method.
The type conforming to this protocol are designed to be called with special provisions by an
See moreAuthenticationService
instance. To prevent them from being called directly, they all take aWebcomMarkers.Restricted
parameter, which could not be instantiated by external code.Declaration
Swift
public protocol AuthenticationMethod : AnyObject, CustomDebugStringConvertible
-
A method that delegates authentication of the current user to a third-party identity provider, ad hoc for the application.
See moreDeclaration
Swift
public final class AuthenticationMethodCustom : AuthenticationSingleStepMethod
-
A method that authenticates the current user using a temporary (virtual) user account.
See moreDeclaration
Swift
public final class AuthenticationMethodGuest : AuthenticationSingleStepMethod
-
A method that authenticates the current user using identities directly managed by the back-end.
This method requires that the user provides input during the authentication process. To complete authentication, there are several methods to call, depending on the provider and the authentication mode.
For example, to attach a new identity using the e-mail provider and a static password:
let method = AuthenticationMethodInternal(provider: .eMail, mode: .staticPassword) Webcom.defaultApplication.authenticationService.initializeAuthentication(with: method, context: .new) method.setIdentifier("president@whitehouse.gov") // or directly sets the e-mail at initialization method.setStaticPassword("...") method.displayName = "Josiah Bartlet" method.attachIdentity { _ in method.setVerificationToken("token received by e-mail") Webcom.defaultApplication.authenticationService.continueAuthentication { result in ... } }
For example, to log-in using an existing identity using the phone provider and a one-time password:
See morelet method = AuthenticationMethodInternal(msisdn: "+12024561111", mode: .oneTimePassword) Webcom.defaultApplication.authenticationService.initializeAuthentication(with: method, context: .new) method.requestOneTimePassword { _ in method.setOneTimePassword("code received by SMS") Webcom.defaultApplication.authenticationService.continueAuthentication { result in ... } }
Declaration
Swift
public final class AuthenticationMethodInternal : AuthenticationMultiStepMethod
extension AuthenticationMethodInternal: WebcomCombinable
-
A method that delegates authentication of the current user to a third-party identity provider, based on the OAuth 2.0 standard.
The user interaction with the provider is isolated from the rest of the application. It uses
See moreASWebAuthenticationSession
.Declaration
Swift
public final class AuthenticationMethodOAuth2 : AuthenticationSingleStepMethod
-
A method that delegates authentication of the current user to a third-party identity provider, which relies on the Orange mobile data network and a physical SIM card or an eSIM of the device.
This method works only for mobile devices connected through the Orange mobile data network, not in Wi-Fi.
See moreDeclaration
Swift
public final class AuthenticationMethodOrangeMobileNetwork : AuthenticationSingleStepMethod
-
A type representing a multi-step authentication method, that is a method which require user interaction driven by the application between different steps.
The
AuthenticationService.authenticate(with:context:queue:then:)
method cannot be used with conforming types. TheAuthenticationService.initializeAuthentication(with:context:)
andAuthenticationService.continueAuthentication(queue:then:)
methods must be used instead.Declaration
Swift
public protocol AuthenticationMultiStepMethod : AuthenticationMethod
-
A value representing an authentication provider.
See moreDeclaration
Swift
public enum AuthenticationProvider : Codable, Hashable, SelfIdentifiable
-
A type representing an identity for a provider.
Such an identity is obtained using an authentication method.
See moreDeclaration
Swift
public protocol AuthenticationProviderIdentity
-
An object representing the Authentication service of a
WebcomApplication
instance. This service makes it possible to reliably identify users of applications, in order to finely control their access to data. It additionally retrieves user identity details when they sign in, which can be used by applications to customize their behavior.To get an object of this type, use the
WebcomApplication.authenticationService
property of aWebcomApplication
instance. There is only one instance of this class for eachWebcomApplication
instance.Three kinds of authentication methods are available:
AuthenticationMethodGuest
, which gives a temporary (virtual) user account,AuthenticationMethodInternal
, which uses identities directly managed by the back-end, using user e-mail address or user phone number,- delegated authentication methods, based on a third-party identity provider, which includes:
AuthenticationMethodOrangeMobileNetwork
, which relies on the Orange mobile data network and a physical SIM card or an eSIM of the device,AuthenticationMethodOAuth2
, based on the OAuth 2.0 standard,AuthenticationMethodCustom
, for applications using an ad hoc authentication mechanism.
Declaration
Swift
public final class AuthenticationService : WebcomService
extension AuthenticationService: WebcomCombinable
-
A type representing a single-step authentication method, that is a method which do not need user interaction driven by the application once started.
The
AuthenticationService.authenticate(with:context:queue:then:)
method can be used with conforming types.Declaration
Swift
public protocol AuthenticationSingleStepMethod : AuthenticationMethod
-
A value representing an authentication state.
After using the
AuthenticationService.unauthenticate(queue:then:)
method, the authentication always goes into theAuthenticationState.unauthenticated
state.After a successful authentication, the authentication always goes into the
AuthenticationState.authenticated(details:)
state.After a failed authentication, the authentication state never changes. In particular, the
AuthenticationState.authenticated(details:)
state is preserved since the previous authentication is always valid.When the connection to the back-end is lost, the authentication state is frozen, unless the
See moreAuthenticationService.unauthenticate(queue:then:)
method is used.Declaration
Swift
@frozen public enum AuthenticationState : Codable, Equatable, CustomStringConvertible, CustomDebugStringConvertible
-
An object representing a subscription to Authentication events.
Instances are created by the
See moreAuthenticationService.subscribe(stores:file:line:queue:onEvent:onCompletion:)
method.Declaration
Swift
public final class AuthenticationSubscription : Hashable, CustomStringConvertible, CustomDebugStringConvertible