p2-inc / keycloak-orgs

Single realm, multi-tenancy for SaaS apps
https://phasetwo.io
Other
418 stars 72 forks source link

Port to use `IdentityProviderStorageProvider` #274

Closed xgp closed 1 month ago

xgp commented 1 month ago

Keycloak 26 introduces a separate storage provider for identity providers https://www.keycloak.org/docs-api/latest/javadocs/org/keycloak/models/IdentityProviderStorageProvider.html. We need to port our deprecated use of the methods on the RealmModel to use the new provider.

[WARNING] /home/garth/projects/saascrud/keycloak-orgs/src/main/java/io/phasetwo/service/auth/idp/IdpSelectorAuthenticator.java:[42,63] [deprecation] getIdentityProviderByAlias(String) in RealmModel has been deprecated
[WARNING] /home/garth/projects/saascrud/keycloak-orgs/src/main/java/io/phasetwo/service/importexport/KeycloakOrgsImportConverter.java:[114,39] [deprecation] getIdentityProviderByAlias(String) in RealmModel has been deprecated
[WARNING] /home/garth/projects/saascrud/keycloak-orgs/src/main/java/io/phasetwo/service/importexport/KeycloakOrgsImportConverter.java:[118,13] [deprecation] updateIdentityProvider(IdentityProviderModel) in RealmModel has been deprecated
[WARNING] /home/garth/projects/saascrud/keycloak-orgs/src/main/java/io/phasetwo/service/model/jpa/OrganizationAdapter.java:[323,8] [deprecation] getIdentityProvidersStream() in RealmModel has been deprecated
[WARNING] /home/garth/projects/saascrud/keycloak-orgs/src/main/java/io/phasetwo/service/auth/idp/HomeIdpDiscoverer.java:[162,55] [deprecation] getIdentityProvidersStream() in RealmModel has been deprecated
[WARNING] /home/garth/projects/saascrud/keycloak-orgs/src/main/java/io/phasetwo/service/resource/OrganizationsResource.java:[192,10] [deprecation] getIdentityProvidersStream() in RealmModel has been deprecated
[WARNING] /home/garth/projects/saascrud/keycloak-orgs/src/main/java/io/phasetwo/service/resource/OrganizationsResource.java:[198,21] [deprecation] updateIdentityProvider(IdentityProviderModel) in RealmModel has been deprecated
[WARNING] /home/garth/projects/saascrud/keycloak-orgs/src/main/java/io/phasetwo/service/resource/IdentityProvidersResource.java:[62,8] [deprecation] getIdentityProvidersStream() in RealmModel has been deprecated
[WARNING] /home/garth/projects/saascrud/keycloak-orgs/src/main/java/io/phasetwo/service/resource/IdentityProvidersResource.java:[110,10] [deprecation] getIdentityProvidersStream() in RealmModel has been deprecated
[WARNING] /home/garth/projects/saascrud/keycloak-orgs/src/main/java/io/phasetwo/service/resource/IdentityProvidersResource.java:[118,21] [deprecation] updateIdentityProvider(IdentityProviderModel) in RealmModel has been deprecated
[WARNING] /home/garth/projects/saascrud/keycloak-orgs/src/main/java/io/phasetwo/service/resource/IdentityProvidersResource.java:[178,37] [deprecation] getIdentityProviderByAlias(String) in RealmModel has been deprecated
[WARNING] /home/garth/projects/saascrud/keycloak-orgs/src/main/java/io/phasetwo/service/resource/IdentityProvidersResource.java:[201,11] [deprecation] updateIdentityProvider(IdentityProviderModel) in RealmModel has been deprecated
[WARNING] /home/garth/projects/saascrud/keycloak-orgs/src/main/java/io/phasetwo/service/resource/IdentityProviderResource.java:[57,37] [deprecation] getIdentityProviderByAlias(String) in RealmModel has been deprecated
[WARNING] /home/garth/projects/saascrud/keycloak-orgs/src/main/java/io/phasetwo/service/resource/IdentityProviderResource.java:[63,9] [deprecation] updateIdentityProvider(IdentityProviderModel) in RealmModel has been deprecated
[WARNING] /home/garth/projects/saascrud/keycloak-orgs/src/main/java/io/phasetwo/service/resource/IdentityProviderResource.java:[71,37] [deprecation] getIdentityProviderByAlias(String) in RealmModel has been deprecated

Note: strange that these new methods don't take a RealmModel. I'm assuming they do something ambiguous like take the realm out of the KeycloakContext, which means we'll probably have to check any places where we use these methods that it's not in the context (potentially import/export?).

xgp commented 1 month ago

Fixed in #278