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

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

Introduction

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

Prototype

JwkDefinitionHolder getDefinitionLoadIfNecessary(String keyId) 

Source Link

Document

Returns the JWK definition matching the provided keyId ("kid").

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();//from  w  ww.  ja va 2s  .  co m
}