[keycloak-user] Is it possible to extend the default max size of user attributes?

Schuster Sebastian (INST-CSS/BSV-OS2) Sebastian.Schuster at bosch-si.com
Thu Apr 18 03:55:23 EDT 2019


Hi Matthieu,

The way we did this was to add a custom migration to our docker image like that:
We added a file jpa-changelog-4.3.0-attributes.xml with the following content:

<?xml version="1.0" encoding="UTF-8" standalone="no"?>

<databaseChangeLog xmlns="http://www.liquibase.org/xml/ns/dbchangelog" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.liquibase.org/xml/ns/dbchangelog http://www.liquibase.org/xml/ns/dbchangelog/dbchangelog-3.1.xsd">

    <changeSet author="xyz at example.com" id="4.3.0-attributes">
        <preConditions onSqlOutput="TEST" onFail="MARK_RAN">
            <dbms type="mssql" />
        </preConditions>

        <modifyDataType tableName="USER_ATTRIBUTE" columnName="VALUE" newDataType="NVARCHAR(MAX)"/>
    </changeSet>

</databaseChangeLog>

And run the following script when creating our image:
#!/bin/bash

KEYCLOAK_VERSION=$1

model_jpa="keycloak-model-jpa-${KEYCLOAK_VERSION}.jar"
match='    <include file=\"META-INF\/jpa-changelog-4.3.0.xml\"\/>'
insert='    <include file=\"META-INF\/jpa-changelog-4.3.0-attributes.xml\"\/>'
file="META-INF/jpa-changelog-master.xml"

jar -xf $model_jpa $file

sed -i "s/$match/$match\n$insert/" $file

mv jpa-changelog-4.3.0-attributes.xml ./META-INF/

jar -uf $model_jpa ./META-INF/

I admit it is pretty hacky but it does its job and did not cause any problems so far.

Best regards,
Sebastian



Mit freundlichen Grüßen / Best regards

Dr.-Ing. Sebastian Schuster

Open Source Services (INST-CSS/BSV-OS2) 
Bosch Software Innovations GmbH | Ullsteinstr. 128 | 12109 Berlin | GERMANY | www.bosch-si.com
Tel. +49 30 726112-485 | Mobil +49 152 02177668 | Fax +49 30 726112-100 | Sebastian.Schuster at bosch-si.com

Sitz: Berlin, Registergericht: Amtsgericht Charlottenburg; HRB 148411 B 
Aufsichtsratsvorsitzender: Dr.-Ing. Thorsten Lücke; Geschäftsführung: Dr. Stefan Ferber, Michael Hahn, Dr. Aleksandar Mitrovic 



-----Ursprüngliche Nachricht-----
Von: keycloak-user-bounces at lists.jboss.org <keycloak-user-bounces at lists.jboss.org> Im Auftrag von Matthieu Huin
Gesendet: Mittwoch, 17. April 2019 18:23
An: keycloak-user at lists.jboss.org
Betreff: [keycloak-user] Is it possible to extend the default max size of user attributes?

Hello,

I would like to store a user's public SSH keys as a custom attribute in Keycloak 5.0. Unfortunately it seems that the default max size of attributes is 255 characters. Is it possible to configure this to an arbitrarily higher value?

Thanks,

MHU
_______________________________________________
keycloak-user mailing list
keycloak-user at lists.jboss.org
https://lists.jboss.org/mailman/listinfo/keycloak-user



More information about the keycloak-user mailing list