View Javadoc
1   package org.springframework.security.oauth2.provider.code;
2   
3   import java.util.concurrent.ConcurrentHashMap;
4   
5   import org.springframework.security.oauth2.provider.OAuth2Authentication;
6   
7   /**
8    * Implementation of authorization code services that stores the codes and authentication in memory.
9    * 
10   * @author Ryan Heaton
11   * @author Dave Syer
12   */
13  public class InMemoryAuthorizationCodeServices extends RandomValueAuthorizationCodeServices {
14  
15  	protected final ConcurrentHashMap<String, OAuth2Authentication> authorizationCodeStore = new ConcurrentHashMap<String, OAuth2Authentication>();
16  
17  	@Override
18  	protected void store(String code, OAuth2Authentication authentication) {
19  		this.authorizationCodeStore.put(code, authentication);
20  	}
21  
22  	@Override
23  	public OAuth2Authentication remove(String code) {
24  		OAuth2Authentication auth = this.authorizationCodeStore.remove(code);
25  		return auth;
26  	}
27  
28  }