Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Implementation of the JWT policy #1

Closed
wants to merge 1 commit into from
Closed

Implementation of the JWT policy #1

wants to merge 1 commit into from

Conversation

lusoalex
Copy link
Contributor

We added some comments (explain ssh-rsa modulus & exponent)
Remove useless class replaced by Java 8 native classes.

@brasseld brasseld changed the title Remove useless class replaced by Java8 Implementation of the JWT policy Jul 20, 2016
@brasseld
Copy link
Member

brasseld commented Jul 20, 2016

Several things:

  1. Please rebase commits to keep a single commit only (initial implementation of ... blablabla)
  2. Let's try to add this unit test:
    @Test
    public void test_with_cache_enabled_and_no_cache_resource() throws Exception {

        String jwt = "jwtUsedAsKeyCache";

        HttpHeaders headers = new HttpHeaders();
        headers.add("Authorization", "Bearer "+jwt);
        when(request.headers()).thenReturn(headers);
        when(configuration.isUseValidationCache()).thenReturn(true);
        when(configuration.getCacheName()).thenReturn(CACHE_NAME);

        //Mock cache actions.
               when(executionContext.getComponent(ResourceManager.class)).thenReturn(resourceManager);
        when(cache.get(jwt)).thenReturn(element);
        when(element.value()).thenReturn(Instant.now().plusSeconds(7200));

        new JWTPolicy(configuration).onRequest(request, response, executionContext, policyChain);

        verify(policyChain,Mockito.times(1)).failWith(any(PolicyResult.class));
        verify(policyChain,Mockito.times(1)).doNext(request, response);
    }

I'm not sure it's an expected behavior 😉

  1. Remove target/classes from git

Correct test

Add public key resolver option

Use gateway distributed cache repository

remove target folder

add fallback mode when cache is not available

add warn when cache fallback
@brasseld
Copy link
Member

brasseld commented Jul 21, 2016

A new PR has been created from this PR to follow conventions from CONTRIBUTING documentation: #2

@brasseld brasseld closed this Jul 21, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants