Skip to content

1.1.0

Latest

Choose a tag to compare

@jozefizso jozefizso released this 19 Nov 23:09
· 12 commits to main since this release
1.1.0
0da6147

This release renames the main objects so that each one says which OAuth party it talks to (ADR 0016):
OAuthClient for the authorization server, OAuthSession for the signed-in user and ProtectedResourceClient for
the protected resource. The renames break source compatibility in a minor release. This is a deliberate exception to
the promise of 1.0.0, made while the library has no known consumers, and no deprecated aliases are kept. Protocol
behaviour and the format of stored credentials are unchanged, so signed-in users stay signed in after the update.

Added

  • CredentialStore lists its built-in stores as static members, so store: .keychain() and store: .inMemory()
    appear in autocomplete. They take the parameters of the KeychainCredentialStore and InMemoryCredentialStore
    initializers.
  • Documentation of what signing in and out leave at the server: OAuthSession.signIn(with:requestedScope:) adopts
    tokens and authenticates nobody, and signOut(revoke:) leaves the person signed in at the authorization server.
    The session article and the spec name an ephemeral browser session as the only control the client enforces, and
    say that prompt=login (OpenID Connect Core §3.1.2.1) is a request that the server may ignore.

Changed

  • Breaking: TokenManager is OAuthSession, so the two entry points OAuthClient and OAuthSession appear
    together in autocomplete. load() is restore(). invalidate(_:) is discard(_:), because it drops a cached
    token and sends nothing to the server.
  • Breaking: the types that belong to the session are nested in it. SessionEvent is OAuthSession.Event, and
    SignOutReason, SignOutResult and PendingSignOut are OAuthSession.SignOutReason,
    OAuthSession.SignOutResult and OAuthSession.PendingSignOut.
  • Breaking: the event refreshed(target:) is accessTokenUpdated(target:), because a token exchange emits it
    too. Its documentation states that the session caches the token only when its lifetime is known, and that a
    sign-in and exchangeRefreshToken do not emit it.
  • Breaking: CredentialCoding.encode(_:) and CredentialCoding.decode(_:) are Credential.serializedData()
    and Credential(serializedData:). The record format and its version are unchanged, so credentials stored by 1.0
    stay readable.
  • Breaking: RequestAuthorizer is ProtectedResourceClient, because it talks to a protected resource (RFC 6749
    §1.1) and "authorize" names the sign-in flow. Its initializer takes session: instead of manager:.
    sign(_:for:) is addingToken(to:for:), because a bearer token is not a signature.
    data(for:target:session:) is data(for:target:urlSession:), because "session" means the OAuth session.
    RetryDecision is ProtectedResourceClient.RetryDecision.
  • Breaking: PassportObserver is RequestObserver and PassportEvent is RequestEvent, because the events
    report requests and the Passport prefix said only which library they come from. EndpointKind is
    RequestEvent.Endpoint. PassportError is the only type left with the library prefix.

Removed

  • Breaking: EndpointKind.resource. No code emitted it, so an observer never received it.