JwsBuilderFactoryImpl.java 1.36 KB
/*
 * Decompiled with CFR 0_118.
 * 
 * Could not load the following classes:
 *  com.adobe.granite.crypto.CryptoSupport
 *  org.apache.felix.scr.annotations.Component
 *  org.apache.felix.scr.annotations.Reference
 *  org.apache.felix.scr.annotations.Service
 */
package com.adobe.granite.oauth.jwt.impl;

import com.adobe.granite.crypto.CryptoSupport;
import com.adobe.granite.oauth.jwt.JwsBuilder;
import com.adobe.granite.oauth.jwt.JwsBuilderFactory;
import com.adobe.granite.oauth.jwt.impl.JwsBuilderImpl;
import java.security.Key;
import org.apache.felix.scr.annotations.Component;
import org.apache.felix.scr.annotations.Reference;
import org.apache.felix.scr.annotations.Service;

@Component(metatype=0)
@Service
public class JwsBuilderFactoryImpl
implements JwsBuilderFactory {
    @Reference
    private CryptoSupport cryptoSupport;

    public JwsBuilder getInstance(String algorithm, Key key) {
        return new JwsBuilderImpl(algorithm, key, this.cryptoSupport);
    }

    public JwsBuilder getInstance(String algorithm) {
        return this.getInstance(algorithm, null);
    }

    protected void bindCryptoSupport(CryptoSupport cryptoSupport) {
        this.cryptoSupport = cryptoSupport;
    }

    protected void unbindCryptoSupport(CryptoSupport cryptoSupport) {
        if (this.cryptoSupport == cryptoSupport) {
            this.cryptoSupport = null;
        }
    }
}