github DuendeSoftware/products is-8.1.0-preview.8
IdentityServer 8.1.0-preview.8

pre-releaseone hour ago

This is a preview release of IdentityServer 8.1. It builds on Duende Storage 2.0.0-preview.8.

Upgrading from an earlier preview

  • Run the Storage migration. Duende Storage 2.0.0-preview.8 adds schema version 4. Migrate every storage instance before you deploy, with the Duende CLI (duende storage migrate) or in code with IStorageInstanceSchema.MigrateAsync. On SQL Server and PostgreSQL the migration rebuilds part of the search index and can take a while on a large database.
  • Save every user profile again. Unique attribute values, such as userName, use a new storage key that follows the attribute's casing and ignores the casing of the attribute's name. Until a profile written by an earlier preview is saved again, lookups by its unique values don't find it, including password sign-in by userName, and its values aren't checked for uniqueness. Page through the users with IUserProfileAdmin.QueryAsync, and save each one with GetAsync and UpdateAsync. For a unique attribute that isn't case-sensitive, two profiles whose values differ only in case now conflict: one of the saves fails with duplicate_value, and you need to resolve it.
DataRange? range = null;
do
{
    var page = await profileAdmin.QueryAsync(
        new QueryRequest<UserProfileFilter, UserProfileSortField> { Range = range }, ct);

    foreach (var item in page.Results)
    {
        var profile = await profileAdmin.GetAsync(item.SubjectId, ct);
        if (!profile.Found)
        {
            logger.LogWarning("User {SubjectId} not found", item.SubjectId);
            continue;
        }

        var saved = await profileAdmin.UpdateAsync(
            item.SubjectId, profile.Item.ToUpdate(), profile.Version, ct);
        if (!saved.IsSuccess)
        {
            logger.LogWarning("User {SubjectId} could not be saved: {Errors}", item.SubjectId, saved.Errors);
        }
    }

    range = page.HasNextResults && page.ResultsToken is { } nextToken
        ? DataRange.FromContinuationToken(nextToken)
        : null;
}
while (range is not null);
  • Save every space again. The keys that match a request to a space are stored differently, so a space created by an earlier preview isn't found from its URL until it's saved again. Get each space with ISpaceAdmin.GetAsync, and save it with ToUpdate() and UpdateAsync. Use a loop similar to the one above, but then with ISpaceAdmin.
  • Save configuration entities with extended attributes again. Clients, API scopes, API resources, identity resources, identity providers, SAML service providers and spaces now index their extended attributes. An entity saved by an earlier preview isn't found by an attribute filter, an attribute sort or GetByAttributeAsync until it's saved again. Use a loop similar to the one above.
  • Mark inactive users again. Whether a user is active is now part of the user, not a profile attribute, and the default user schemas no longer define active. An active value that SCIM stored as a profile attribute in an earlier preview doesn't carry over: after the upgrade every user is active. active is now a reserved attribute name in the user profile schema, so rename an active attribute in your own schema. After the upgrade, you can no longer use a property called active.
  • Entity Framework configuration store. The Clients table gets a nullable MaxPrivateKeyJwtLifetime column. Generate and apply a migration before you deploy. Without it, every client read fails.

Breaking changes

Admin APIs

  • IUserProfileAdmin works like the other admin interfaces. CreateAsync, GetAsync and UpdateAsync (with an expected version) replace TryAddAsync and TryGetAsync, take an AttributeValueCollection, and return a SaveResult or GetResult. A failed save returns validation_failed, already_exists, not_found, version_conflict or duplicate_value; the codes are constants on StorageErrorCodes. GetByAttributeAsync(code, value) replaces TryGetAsync(code, value). QueryAsync takes a QueryRequest<UserProfileFilter, UserProfileSortField>; userName is an ordinary schema attribute, sorted with SortBy.Attribute.
  • IGroupAdmin and IRoleAdmin use separate read and write models: GroupConfiguration, CreateGroup and UpdateGroup, and RoleConfiguration, CreateRole and UpdateRole, with plain string properties. Group and Role are removed. UpdateAsync replaces the whole entity, so a null description clears it. Invalid values return a validation_failed error instead of throwing. GroupFilter.SearchExpression is removed: put a group filter expression in QueryRequest.Filter, as with every other admin.
  • ISpaceAdmin uses SpaceConfiguration, CreateSpace and UpdateSpace. CreateSpaceConfiguration is removed, and UpdateAsync takes the space id, an UpdateSpace and the expected version.
  • IApiResourceAdmin.CreateSecretAsync takes a CreateApiResourceSecret, like IClientAdmin.CreateSecretAsync takes a CreateClientSecret.
  • QueryRequest<TFilter, TSort>.Sort is a SortBy<TSort>?. A sort enum value converts to it implicitly.
  • QueryResult<T>.HasPrevResults is renamed to HasPreviousResults. Update code that reads or sets it, including Pages/ServerSideSessions/Index.cshtml in projects created from the Quickstart UI templates. If you serialize QueryResult<T>, the JSON property name changes too.
  • Created and last-updated times. The list items and read models of every admin API have required Created and LastUpdated properties. Code that constructs them must set both.
  • Reserved attribute names. An extended attribute can't use the name of one of the entity's built-in fields (for example enabled on a client), created_at or last_updated_at, and a user profile attribute can't be called active. The name is rejected when an entity is saved, when a schema is saved through ISchemaAdmin, and at startup for in-memory schemas.
  • Sort order. In a descending sort, entities without a value for the sort field now come first instead of last. Text sorts by ordinal (binary) order on every database, so accented letters and punctuation can sort differently than under your database's collation.
  • not inside a bracket filter is a true negation. contacts[not (type eq "work")] now also matches entries that have no type.

User Management

  • Attribute names use the schema's spelling. Profile reads, and the extended properties of the other admin APIs, return attribute and property names as the schema spells them, whatever spelling they were stored under. IUserProfileAdmin saves return validation_failed, IUserProfileSelfService throws ArgumentException, and IUserImporter fails the record when a name differs from the schema's spelling. The runtime Properties of a Client, ApiResource, ApiScope, IdentityResource or IdentityProvider saved through an admin API hold the schema's spelling, and their keys compare with case.
  • UserManagementProfileService.IsUserActiveAsync is removed. The default IsActiveAsync answers from the user's active state. To use a different rule, override IsActiveAsync.

Spaces

  • AddSpaces() registers ISpaceAdmin and ISpaceContextAccessor with Add instead of TryAdd. A registration made before AddSpaces() no longer replaces the Spaces implementation. Register your own after AddSpaces().

SCIM

SCIM follows RFC 7643 and RFC 7644 more closely, and some requests that succeeded before now get a 400:

  • An attribute name with surrounding whitespace, such as " password", is rejected instead of trimmed: invalidPath in a PATCH, invalidValue in a create or replace. Before, a padded password could be stored as a plaintext profile attribute.
  • sortBy with an attribute the server can't sort on, and a sortOrder other than ascending or descending, return 400 invalidValue on user and group list and search. Before, they were ignored.
  • externalId on a user, when the profile schema doesn't define it, returns 400 instead of being dropped. DefaultScimUserSchema defines externalId.
  • PATCH add on a multi-valued attribute adds to its values instead of replacing them; use replace to replace the whole list. An add of null or [] changes nothing.
  • PATCH add or replace on a complex attribute, such as name, changes only the sub-attributes in the value and keeps the others. A null sub-attribute clears only that sub-attribute.
  • PATCH on id, schemas, meta or the user's groups returns 400 mutability, and so does a remove of a required attribute, including userName. Before, some of these returned 200, 500, or a different error.
  • User create and replace ignore groups, as a read-only attribute. If your profile schema defines its own groups attribute, SCIM no longer writes it.
  • A group PATCH without a path whose value contains an attribute other than displayName, externalId, members or the group's own id returns 400 instead of ignoring it.
  • A null entry in attributes or excludedAttributes returns 400 invalidValue, with or without a cursor.
  • Users without a value for the sort attribute come first in a descending sort.
  • /Schemas names attributes by their profile code, no longer lists externalId (a common attribute, like id and meta), and lists active.
  • DateTime sub-values are returned in round-trip format, like top-level DateTime attributes.
  • The index-mode count on user lists is limited by ScimOptions.MaxResults as well as 200, as on group lists.

What's changed

Admin APIs

  • Query every admin API the same way. Every admin accepts a typed filter or a filter expression, and a sort by built-in field or by extended attribute. Before, the configuration admins ignored a filter expression and returned every entity. The built-in names are constants on ClientQueryFields, ApiScopeQueryFields and the other QueryFields classes; any other name refers to an extended attribute. Bracket filters such as contacts[type eq "work" and value eq "x"] work on every admin.
  • Look up an entity by a unique extended attribute with GetByAttributeAsync(code, value) on the configuration admins and ISpaceAdmin. IIdentityProviderAdmin has QueryAsync and GetByAttributeAsync overloads that take the schema id of an identity provider type.
  • Sort and filter by created and last-updated time on every admin API, with Created and LastUpdated in each sort enum and created_at and last_updated_at in filter expressions.
  • InvalidQueryException reports an unknown, non-queryable or non-sortable attribute, or a malformed expression, with a Reason and the Field.
  • A conflict on a unique extended attribute returns duplicate_value on ExtendedProperties.<code>.
  • Integer, Date and DateTime values inside complex and list extended properties are returned with their schema types.
  • The built-in identity provider schemas keep client secrets and certificates out of the search index.
  • SaveResult and GetResult declare their nullability, so checking IsSuccess or Found no longer leaves nullable warnings.

Client authentication

  • Limit the lifetime of private_key_jwt client assertions. IdentityServerOptions.MaxPrivateKeyJwtLifetime and Client.MaxPrivateKeyJwtLifetime, in seconds, reject an assertion whose exp is further in the future than the limit, with invalid_client. The client value overrides the global one. Both default to null, so nothing changes until you set one. The global limit also applies to API resources at the introspection endpoint. A custom ISecretsListValidator decorator should implement the new ValidateAsync overload that takes a SecretValidationContext; otherwise only the global limit applies through it.

User Management

  • Inactive users. IUserAdmin.TryGetIsActiveAsync and TrySetIsActiveAsync read and set whether a user is active. An inactive user can't sign in with any User Management authenticator, and gets the same result as for a wrong credential. The default profile service reports the user as inactive to IdentityServer. Marking a user inactive doesn't end the user's existing sessions.
  • Case-sensitive attributes. ScalarAttributeType.Casing (AttributeCasing.Insensitive or Sensitive) declares whether a string attribute compares with case. A unique attribute that isn't case-sensitive rejects values that differ only in case.
  • Optimistic concurrency for user profiles. IUserProfileAdmin.UpdateAsync saves only when the stored version matches, and a failed save says why.
  • A queryable profile string that's too long for the search index is rejected with a validation error. Before, a SCIM write returned 500.

SCIM

  • Cursor pagination. User and group list and search support RFC 9865 cursor pagination, alongside the default index pagination. A cursor is bound to the caller, the space and the query. With more than one instance, share a persistent Data Protection key ring.
  • PATCH value paths. A PATCH can change, add or remove the entries a filter selects, such as emails[type eq "work"].value, for every multi-valued complex attribute.
  • active. Create, replace and PATCH set the user's active state. GET, list and search return it, and filters and sortBy can use it.
  • externalId on groups, settable on create, replace and PATCH, and usable in filters. IGroupAdmin reads and writes the same value.
  • Full schema names. attributes, excludedAttributes, filter, sortBy and user PATCH accept attribute names in the form urn:ietf:params:scim:schemas:core:2.0:User:userName.
  • caseExact. /Schemas reports caseExact from the attribute definition, and filters and sorting compare case-sensitive attributes with case.
  • PATCH add or replace with a null externalId clears it.
  • 401 and 403 responses carry a SCIM error body. When a JWT bearer scheme refuses a bearer token, the 403 also carries WWW-Authenticate: Bearer error="insufficient_scope".
  • Group create, replace and PATCH look up their members in bulk, so a write with 1,000 members costs as many storage calls as one with 10. A failed group write no longer leaves new user records behind.
  • More diagnostic logging: request structure at Debug, request values at Trace with passwords masked, and 4xx responses and filter failures at Information.
  • At startup, IdentityServer logs a warning for each SCIM operation whose custom policy replaces the built-in scheme selection and scope checks.

Spaces

  • Spaces accept list and complex extended properties, and index them like the other entities.

Fixes

  • ISpaceAdmin.UpdateAsync could write to a different space than the one it checked.
  • ISpaceAdmin.CreateAsync ignored Enabled and always created an enabled space.
  • Undeleting a space no longer reports an attribute whose name changed only in case as dropped.
  • IClientAdmin.CreateSecretAsync and IApiResourceAdmin.CreateSecretAsync save the values they validated, even if the caller changes the model while the call runs.
  • Reading a stored complex value with a repeated property name no longer throws.
  • SCIM PATCH of one sub-attribute no longer fails when another sub-attribute of the same attribute holds an Integer, Date or DateTime value.
  • Filter expressions with co, sw or ew on a list field, such as a client's grant types, match part of an entry. Before, they matched only the whole entry, so grantType sw "client" didn't find client_credentials.
  • Bracket filters with not, or or parentheses inside the brackets return results instead of throwing.
  • The error for an admin service that isn't available names AddConfigurationStorage(), not only AddStorage().

Full Changelog: is-8.1.0-preview.7...is-8.1.0-preview.8

Don't miss a new products release

NewReleases is sending notifications on new releases.