Database backed authorization-code-service now works.

pull/210/head
Amanda Anganes 2012-08-23 10:46:08 -04:00
parent 4b76cc514b
commit c23b176567
5 changed files with 17 additions and 6 deletions

View File

@ -32,13 +32,21 @@ public class AuthorizationCodeEntity {
private AuthorizationRequestHolder authorizationRequestHolder;
/**
* Default constructor.
*/
public AuthorizationCodeEntity() {
}
/**
* Create a new AuthorizationCodeEntity with the given code.
*
* @param code the authorization code
*/
public AuthorizationCodeEntity(String code) {
public AuthorizationCodeEntity(String code, AuthorizationRequestHolder authRequest) {
this.code = code;
this.authorizationRequestHolder = authRequest;
}
/**
@ -76,7 +84,7 @@ public class AuthorizationCodeEntity {
* @return the authorizationRequestHolder
*/
@Lob
@Basic(fetch=FetchType.LAZY)
@Basic(fetch=FetchType.EAGER)
@Column(name="authorization_request_holder")
public AuthorizationRequestHolder getAuthorizationRequestHolder() {
return authorizationRequestHolder;

View File

@ -53,7 +53,10 @@ public class JpaAuthorizationCodeRepository implements AuthorizationCodeReposito
throw new InvalidGrantException("JpaAuthorizationCodeRepository: no authorization code found for value " + code);
}
return result.getAuthorizationRequestHolder();
AuthorizationRequestHolder authRequest = result.getAuthorizationRequestHolder();
//authRequest.getAuthenticationRequest();
return authRequest;
}

View File

@ -31,8 +31,7 @@ public class DefaultOAuth2AuthorizationCodeService implements AuthorizationCodeS
public String createAuthorizationCode(AuthorizationRequestHolder authentication) {
String code = generator.generate();
AuthorizationCodeEntity entity = new AuthorizationCodeEntity(code);
AuthorizationCodeEntity entity = new AuthorizationCodeEntity(code, authentication);
repository.save(entity);
return code;

View File

@ -9,6 +9,7 @@
<class>org.mitre.oauth2.model.OAuth2AccessTokenEntity</class>
<class>org.mitre.oauth2.model.OAuth2RefreshTokenEntity</class>
<class>org.mitre.oauth2.model.AuthenticationHolder</class>
<class>org.mitre.oauth2.model.AuthorizationCodeEntity</class>
<class>org.mitre.openid.connect.model.Address</class>
<class>org.mitre.openid.connect.model.ApprovedSite</class>
<class>org.mitre.openid.connect.model.Event</class>

View File

@ -85,7 +85,7 @@
authorization-endpoint-url="/authorize"
token-endpoint-url="/token">
<oauth:authorization-code />
<oauth:authorization-code authorization-code-services-ref="defaultOAuth2AuthorizationCodeService"/>
<oauth:implicit />
</oauth:authorization-server>