All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.wiremock.extension.jwt.JwtInitialiser Maven / Gradle / Ivy

The newest version!
package org.wiremock.extension.jwt;

import com.github.tomakehurst.wiremock.extension.MappingsLoaderExtension;
import com.github.tomakehurst.wiremock.stubbing.StubMappings;

public class JwtInitialiser implements MappingsLoaderExtension {

    private final JwtSigningKeySettings jwtSigningKeySettings;
    
    private boolean initialised = false;

    public JwtInitialiser(JwtSigningKeySettings jwtSigningKeySettings) {
        this.jwtSigningKeySettings = jwtSigningKeySettings;
    }

    @Override
    public void loadMappingsInto(StubMappings stubMappings) {
        initialise();
    }

    private void initialise() {
        if (!initialised) {
            synchronized (this) {
                if (!initialised) {
                    jwtSigningKeySettings.initialise();
                    initialised = true;
                }
            }
        }
    }

    @Override
    public String getName() {
        return "jwt-initialiser";
    }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy