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 more

    Declaration

    Swift

    public struct AuthenticationDetails : AuthenticationProviderIdentity, Codable, Equatable, CustomStringConvertible, CustomDebugStringConvertible
    extension AuthenticationDetails: WebcomCombinable
  • A value representing an event of the AuthenticationService.

    See more

    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 AuthenticationService instance. To prevent them from being called directly, they all take a WebcomMarkers.Restricted parameter, which could not be instantiated by external code.

    See more

    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 more

    Declaration

    Swift

    public final class AuthenticationMethodCustom : AuthenticationSingleStepMethod
  • A method that authenticates the current user using a temporary (virtual) user account.

    See more

    Declaration

    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:

    let 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 ... }
    }
    
    See more

    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 ASWebAuthenticationSession.

    See more

    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 more

    Declaration

    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. The AuthenticationService.initializeAuthentication(with:context:) and AuthenticationService.continueAuthentication(queue:then:) methods must be used instead.

    Declaration

    Swift

    public protocol AuthenticationMultiStepMethod : AuthenticationMethod
  • A value representing an authentication provider.

    See more

    Declaration

    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 more

    Declaration

    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 a WebcomApplication instance. There is only one instance of this class for each WebcomApplication instance.

    Three kinds of authentication methods are available:

    See more

    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 the AuthenticationState.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 AuthenticationService.unauthenticate(queue:then:) method is used.

    See more

    Declaration

    Swift

    @frozen
    public enum AuthenticationState : Codable, Equatable, CustomStringConvertible, CustomDebugStringConvertible
  • An object representing a subscription to Authentication events.

    Instances are created by the AuthenticationService.subscribe(stores:file:line:queue:onEvent:onCompletion:) method.

    See more

    Declaration

    Swift

    public final class AuthenticationSubscription : Hashable, CustomStringConvertible, CustomDebugStringConvertible