Database backed authorization-code-service now works.
parent
4b76cc514b
commit
c23b176567
|
@ -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;
|
||||
|
|
|
@ -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;
|
||||
|
||||
}
|
||||
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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>
|
||||
|
|
|
@ -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>
|
||||
|
|
Loading…
Reference in New Issue