services/src/main/java/org/keycloak/services/resources/admin/RealmAdminResource.java
/**
     * Update the top-level information of this realm.  Any user, roles or client information in the representation
     * will be ignored.  This will only update top-level attributes of the realm.
     *
     * @param rep
     * @return
     */
Update the top-level information of this realm.  Any user, roles or client information in the representation
will be ignored.  This will only update top-level attributes of the realm.

@param rep
@return
Update the top - level information of this realm . Any user roles or client information in the representation will be ignored . This will only update top - level attributes of the realm . @param rep @return
@PUT
    @Consumes(MediaType.APPLICATION_JSON)
    public Response updateRealm(final RealmRepresentation rep) {
        auth.requireManage();
        logger.debug("updating realm: " + realm.getName());
        try {
            RepresentationToModel.updateRealm(rep, realm);
            if (rep.isRealmCacheEnabled() != null && session.realms() instanceof CacheRealmProvider) {
                CacheRealmProvider cacheRealmProvider = (CacheRealmProvider)session.realms();
                cacheRealmProvider.setEnabled(rep.isRealmCacheEnabled());
            }
            if (rep.isUserCacheEnabled() != null && session.userStorage() instanceof CacheUserProvider) {
                CacheUserProvider cache = (CacheUserProvider)session.userStorage();
                cache.setEnabled(rep.isUserCacheEnabled());
            }
            List<UserFederationProviderModel> federationProviders = realm.getUserFederationProviders();
            UsersSyncManager usersSyncManager = new UsersSyncManager();
            for (final UserFederationProviderModel fedProvider : federationProviders) {
                usersSyncManager.refreshPeriodicSyncForProvider(session.getKeycloakSessionFactory(), session.getProvider(TimerProvider.class), fedProvider, realm.getId());
            }
            adminEvent.operation(OperationType.UPDATE).representation(rep).success();
            return Response.noContent().build();
        } catch (PatternSyntaxException e) {
            return ErrorResponse.error("Specified regex pattern(s) is invalid.", Response.Status.BAD_REQUEST);
        } catch (ModelDuplicateException e) {
            throw e;
        } catch (Exception e) {
            logger.error(e);
            return ErrorResponse.error("Failed to update " + rep.getRealm() + " Realm.", Response.Status.INTERNAL_SERVER_ERROR);
        }
    }
@ PUT @ Consumes ( MediaType . APPLICATION_JSON ) public Response updateRealm ( final RealmRepresentation rep ) { auth . requireManage ( ) ; logger . debug ( "updating realm: " + realm . getName ( ) ) ; try { RepresentationToModel . updateRealm ( rep , realm ) ; if ( rep . isRealmCacheEnabled ( ) != null && session . realms ( ) instanceof CacheRealmProvider ) { CacheRealmProvider cacheRealmProvider = ( CacheRealmProvider ) session . realms ( ) ; cacheRealmProvider . setEnabled ( rep . isRealmCacheEnabled ( ) ) ; } if ( rep . isUserCacheEnabled ( ) != null && session . userStorage ( ) instanceof CacheUserProvider ) { CacheUserProvider cache = ( CacheUserProvider ) session . userStorage ( ) ; cache . setEnabled ( rep . isUserCacheEnabled ( ) ) ; } List < UserFederationProviderModel > federationProviders = realm . getUserFederationProviders ( ) ; UsersSyncManager usersSyncManager = new UsersSyncManager ( ) ; for ( final UserFederationProviderModel fedProvider : federationProviders ) { usersSyncManager . refreshPeriodicSyncForProvider ( session . getKeycloakSessionFactory ( ) , session . getProvider ( TimerProvider . class ) , fedProvider , realm . getId ( ) ) ; } adminEvent . operation ( OperationType . UPDATE ) . representation ( rep ) . success ( ) ; return Response . noContent ( ) . build ( ) ; } catch ( PatternSyntaxException e ) { return ErrorResponse . error ( "Specified regex pattern(s) is invalid." , Response . Status . BAD_REQUEST ) ; } catch ( ModelDuplicateException e ) { throw e ; } catch ( Exception e ) { logger . error ( e ) ; return ErrorResponse . error ( "Failed to update " + rep . getRealm ( ) + " Realm." , Response . Status . INTERNAL_SERVER_ERROR ) ; } }
Update the top-level information of this realm.
Update the top - level information of this realm .
// Refresh periodic sync tasks for configured federationProviders