Example usage for org.springframework.security.oauth2.common OAuth2AccessToken equals

List of usage examples for org.springframework.security.oauth2.common OAuth2AccessToken equals

Introduction

In this page you can find the example usage for org.springframework.security.oauth2.common OAuth2AccessToken equals.

Prototype

public boolean equals(Object obj) 

Source Link

Document

Indicates whether some other object is "equal to" this one.

Usage

From source file:org.apigw.authserver.svc.impl.TokenServicesImplTest.java

@Test
@DirtiesContext/*from   www. j av a2s .  co  m*/
public void testOneAccessTokenPerAuthentication() throws Exception {
    OAuth2Authentication authentication = new OAuth2Authentication(
            createAuthorizationRequest(CLIENT, Collections.singleton(READ_SCOPE)),
            new TestAuthentication(false));
    OAuth2AccessToken first = services.createAccessToken(authentication);

    assertEquals(1, authorizationGrantRepository.count());
    OAuth2AccessToken second = services.createAccessToken(authentication);
    assertFalse(first.equals(second));
    assertEquals(1, authorizationGrantRepository.count());
}