Example usage for org.springframework.security.oauth2.provider.token.store.jwk JwkDefinitionSource loadJwkDefinitions

List of usage examples for org.springframework.security.oauth2.provider.token.store.jwk JwkDefinitionSource loadJwkDefinitions

Introduction

In this page you can find the example usage for org.springframework.security.oauth2.provider.token.store.jwk JwkDefinitionSource loadJwkDefinitions.

Prototype

static Map<String, JwkDefinitionHolder> loadJwkDefinitions(URL jwkSetUrl) 

Source Link

Document

Fetches the JWK Set from the provided URL and returns a Map keyed by the JWK keyId ("kid") and mapped to an association of the JwkDefinition and SignatureVerifier .

Usage

From source file:org.springframework.security.oauth2.provider.token.store.jwk.JwkDefinitionSourceTest.java

@Test
public void getDefinitionLoadIfNecessaryWhenKeyIdNotFoundThenLoadJwkDefinitions() throws Exception {
    JwkDefinitionSource jwkDefinitionSource = spy(new JwkDefinitionSource(DEFAULT_JWK_SET_URL));
    mockStatic(JwkDefinitionSource.class);
    when(JwkDefinitionSource.loadJwkDefinitions(any(URL.class)))
            .thenReturn(Collections.<String, JwkDefinitionSource.JwkDefinitionHolder>emptyMap());
    jwkDefinitionSource.getDefinitionLoadIfNecessary("invalid-key-id");
    verifyStatic();//  w  w w. ja v  a2s .co m
}