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 withIStorageInstanceSchema.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 byuserName, and its values aren't checked for uniqueness. Page through the users withIUserProfileAdmin.QueryAsync, and save each one withGetAsyncandUpdateAsync. For a unique attribute that isn't case-sensitive, two profiles whose values differ only in case now conflict: one of the saves fails withduplicate_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 withToUpdate()andUpdateAsync. 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
GetByAttributeAsyncuntil 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. Anactivevalue that SCIM stored as a profile attribute in an earlier preview doesn't carry over: after the upgrade every user is active.activeis now a reserved attribute name in the user profile schema, so rename anactiveattribute in your own schema. After the upgrade, you can no longer use a property calledactive. - Entity Framework configuration store. The
Clientstable gets a nullableMaxPrivateKeyJwtLifetimecolumn. Generate and apply a migration before you deploy. Without it, every client read fails.
Breaking changes
Admin APIs
IUserProfileAdminworks like the other admin interfaces.CreateAsync,GetAsyncandUpdateAsync(with an expected version) replaceTryAddAsyncandTryGetAsync, take anAttributeValueCollection, and return aSaveResultorGetResult. A failed save returnsvalidation_failed,already_exists,not_found,version_conflictorduplicate_value; the codes are constants onStorageErrorCodes.GetByAttributeAsync(code, value)replacesTryGetAsync(code, value).QueryAsynctakes aQueryRequest<UserProfileFilter, UserProfileSortField>;userNameis an ordinary schema attribute, sorted withSortBy.Attribute.IGroupAdminandIRoleAdminuse separate read and write models:GroupConfiguration,CreateGroupandUpdateGroup, andRoleConfiguration,CreateRoleandUpdateRole, with plainstringproperties.GroupandRoleare removed.UpdateAsyncreplaces the whole entity, so anulldescription clears it. Invalid values return avalidation_failederror instead of throwing.GroupFilter.SearchExpressionis removed: put a group filter expression inQueryRequest.Filter, as with every other admin.ISpaceAdminusesSpaceConfiguration,CreateSpaceandUpdateSpace.CreateSpaceConfigurationis removed, andUpdateAsynctakes the space id, anUpdateSpaceand the expected version.IApiResourceAdmin.CreateSecretAsynctakes aCreateApiResourceSecret, likeIClientAdmin.CreateSecretAsynctakes aCreateClientSecret.QueryRequest<TFilter, TSort>.Sortis aSortBy<TSort>?. A sort enum value converts to it implicitly.QueryResult<T>.HasPrevResultsis renamed toHasPreviousResults. Update code that reads or sets it, includingPages/ServerSideSessions/Index.cshtmlin projects created from the Quickstart UI templates. If you serializeQueryResult<T>, the JSON property name changes too.- Created and last-updated times. The list items and read models of every admin API have required
CreatedandLastUpdatedproperties. 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
enabledon a client),created_atorlast_updated_at, and a user profile attribute can't be calledactive. The name is rejected when an entity is saved, when a schema is saved throughISchemaAdmin, 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.
notinside a bracket filter is a true negation.contacts[not (type eq "work")]now also matches entries that have notype.
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.
IUserProfileAdminsaves returnvalidation_failed,IUserProfileSelfServicethrowsArgumentException, andIUserImporterfails the record when a name differs from the schema's spelling. The runtimePropertiesof aClient,ApiResource,ApiScope,IdentityResourceorIdentityProvidersaved through an admin API hold the schema's spelling, and their keys compare with case. UserManagementProfileService.IsUserActiveAsyncis removed. The defaultIsActiveAsyncanswers from the user's active state. To use a different rule, overrideIsActiveAsync.
Spaces
AddSpaces()registersISpaceAdminandISpaceContextAccessorwithAddinstead ofTryAdd. A registration made beforeAddSpaces()no longer replaces the Spaces implementation. Register your own afterAddSpaces().
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:invalidPathin a PATCH,invalidValuein a create or replace. Before, a paddedpasswordcould be stored as a plaintext profile attribute. sortBywith an attribute the server can't sort on, and asortOrderother thanascendingordescending, return 400invalidValueon user and group list and search. Before, they were ignored.externalIdon a user, when the profile schema doesn't define it, returns 400 instead of being dropped.DefaultScimUserSchemadefinesexternalId.- PATCH
addon a multi-valued attribute adds to its values instead of replacing them; usereplaceto replace the whole list. Anaddofnullor[]changes nothing. - PATCH
addorreplaceon a complex attribute, such asname, changes only the sub-attributes in the value and keeps the others. Anullsub-attribute clears only that sub-attribute. - PATCH on
id,schemas,metaor the user'sgroupsreturns 400mutability, and so does aremoveof a required attribute, includinguserName. 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 owngroupsattribute, SCIM no longer writes it. - A group PATCH without a path whose value contains an attribute other than
displayName,externalId,membersor the group's ownidreturns 400 instead of ignoring it. - A
nullentry inattributesorexcludedAttributesreturns 400invalidValue, with or without a cursor. - Users without a value for the sort attribute come first in a descending sort.
/Schemasnames attributes by their profile code, no longer listsexternalId(a common attribute, likeidandmeta), and listsactive.- DateTime sub-values are returned in round-trip format, like top-level DateTime attributes.
- The index-mode
counton user lists is limited byScimOptions.MaxResultsas 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,ApiScopeQueryFieldsand the otherQueryFieldsclasses; any other name refers to an extended attribute. Bracket filters such ascontacts[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 andISpaceAdmin.IIdentityProviderAdminhasQueryAsyncandGetByAttributeAsyncoverloads that take the schema id of an identity provider type. - Sort and filter by created and last-updated time on every admin API, with
CreatedandLastUpdatedin each sort enum andcreated_atandlast_updated_atin filter expressions. InvalidQueryExceptionreports an unknown, non-queryable or non-sortable attribute, or a malformed expression, with aReasonand theField.- A conflict on a unique extended attribute returns
duplicate_valueonExtendedProperties.<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.
SaveResultandGetResultdeclare their nullability, so checkingIsSuccessorFoundno longer leaves nullable warnings.
Client authentication
- Limit the lifetime of
private_key_jwtclient assertions.IdentityServerOptions.MaxPrivateKeyJwtLifetimeandClient.MaxPrivateKeyJwtLifetime, in seconds, reject an assertion whoseexpis further in the future than the limit, withinvalid_client. The client value overrides the global one. Both default tonull, so nothing changes until you set one. The global limit also applies to API resources at the introspection endpoint. A customISecretsListValidatordecorator should implement the newValidateAsyncoverload that takes aSecretValidationContext; otherwise only the global limit applies through it.
User Management
- Inactive users.
IUserAdmin.TryGetIsActiveAsyncandTrySetIsActiveAsyncread 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.InsensitiveorSensitive) 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.UpdateAsyncsaves 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 andsortBycan use it.externalIdon groups, settable on create, replace and PATCH, and usable in filters.IGroupAdminreads and writes the same value.- Full schema names.
attributes,excludedAttributes,filter,sortByand user PATCH accept attribute names in the formurn:ietf:params:scim:schemas:core:2.0:User:userName. caseExact./SchemasreportscaseExactfrom the attribute definition, and filters and sorting compare case-sensitive attributes with case.- PATCH
addorreplacewith anullexternalIdclears 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.UpdateAsynccould write to a different space than the one it checked.ISpaceAdmin.CreateAsyncignoredEnabledand always created an enabled space.- Undeleting a space no longer reports an attribute whose name changed only in case as dropped.
IClientAdmin.CreateSecretAsyncandIApiResourceAdmin.CreateSecretAsyncsave 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,sworewon a list field, such as a client's grant types, match part of an entry. Before, they matched only the whole entry, sograntType sw "client"didn't findclient_credentials. - Bracket filters with
not,oror parentheses inside the brackets return results instead of throwing. - The error for an admin service that isn't available names
AddConfigurationStorage(), not onlyAddStorage().
Full Changelog: is-8.1.0-preview.7...is-8.1.0-preview.8