View Javadoc
1   package org.springframework.security.oauth2.provider.code;
2   
3   import org.springframework.security.oauth2.common.exceptions.InvalidGrantException;
4   import org.springframework.security.oauth2.provider.OAuth2Authentication;
5   
6   /**
7    * Services for issuing and storing authorization codes.
8    * 
9    * @author Ryan Heaton
10   */
11  public interface AuthorizationCodeServices {
12  
13  	/**
14  	 * Create a authorization code for the specified authentications.
15  	 * 
16  	 * @param authentication The authentications to store.
17  	 * @return The generated code.
18  	 */
19  	String createAuthorizationCode(OAuth2Authentication authentication);
20  
21  	/**
22  	 * Consume a authorization code.
23  	 * 
24  	 * @param code The authorization code to consume.
25  	 * @return The authentications associated with the code.
26  	 * @throws InvalidGrantException If the authorization code is invalid or expired.
27  	 */
28  	OAuth2Authentication consumeAuthorizationCode(String code)
29  			throws InvalidGrantException;
30  
31  }