Java Code Examples for org.keycloak.component.ComponentModel#setNote()

The following examples show how to use org.keycloak.component.ComponentModel#setNote() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: AbstractEcdsaKeyProvider.java    From keycloak with Apache License 2.0 5 votes vote down vote up
public AbstractEcdsaKeyProvider(RealmModel realm, ComponentModel model) {
    this.model = model;
    this.status = KeyStatus.from(model.get(Attributes.ACTIVE_KEY, true), model.get(Attributes.ENABLED_KEY, true));

    if (model.hasNote(KeyWrapper.class.getName())) {
        key = model.getNote(KeyWrapper.class.getName());
    } else {
        key = loadKey(realm, model);
        model.setNote(KeyWrapper.class.getName(), key);
    }
}
 
Example 2
Source File: AbstractGeneratedSecretKeyProvider.java    From keycloak with Apache License 2.0 5 votes vote down vote up
public AbstractGeneratedSecretKeyProvider(ComponentModel model, KeyUse use, String type, String algorithm) {
    this.status = KeyStatus.from(model.get(Attributes.ACTIVE_KEY, true), model.get(Attributes.ENABLED_KEY, true));
    this.kid = model.get(Attributes.KID_KEY);
    this.model = model;
    this.use = use;
    this.type = type;
    this.algorithm = algorithm;

    if (model.hasNote(SecretKey.class.getName())) {
        secretKey = model.getNote(SecretKey.class.getName());
    } else {
        secretKey = KeyUtils.loadSecretKey(Base64Url.decode(model.get(Attributes.SECRET_KEY)), JavaAlgorithm.getJavaAlgorithm(algorithm));
        model.setNote(SecretKey.class.getName(), secretKey);
    }
}
 
Example 3
Source File: AbstractRsaKeyProvider.java    From keycloak with Apache License 2.0 5 votes vote down vote up
public AbstractRsaKeyProvider(RealmModel realm, ComponentModel model) {
    this.model = model;
    this.status = KeyStatus.from(model.get(Attributes.ACTIVE_KEY, true), model.get(Attributes.ENABLED_KEY, true));
    this.algorithm = model.get(Attributes.ALGORITHM_KEY, Algorithm.RS256);

    if (model.hasNote(KeyWrapper.class.getName())) {
        key = model.getNote(KeyWrapper.class.getName());
    } else {
        key = loadKey(realm, model);
        model.setNote(KeyWrapper.class.getName(), key);
    }
}