Reset ConnectAuthorizationRequestManager to version from master

pull/263/merge
Amanda Anganes 2013-01-23 15:57:47 -05:00
parent 06f970e61b
commit dd8b48e863
1 changed files with 22 additions and 37 deletions

View File

@ -15,7 +15,6 @@ import org.slf4j.Logger;
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.InitializingBean; import org.springframework.beans.factory.InitializingBean;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.core.context.SecurityContextHolder;
import org.springframework.security.oauth2.common.exceptions.InvalidClientException; import org.springframework.security.oauth2.common.exceptions.InvalidClientException;
import org.springframework.security.oauth2.common.exceptions.InvalidScopeException; import org.springframework.security.oauth2.common.exceptions.InvalidScopeException;
import org.springframework.security.oauth2.common.util.OAuth2Utils; import org.springframework.security.oauth2.common.util.OAuth2Utils;
@ -77,43 +76,29 @@ public class ConnectAuthorizationRequestManager implements AuthorizationRequestM
String requestNonce = parameters.get("nonce"); String requestNonce = parameters.get("nonce");
Object principal = SecurityContextHolder.getContext().getAuthentication().getPrincipal();
boolean anonymous = false;
if (principal instanceof String) {
if (principal.toString().equals("anonymousUser")) {
anonymous = true;
}
}
//If a nonce was included in the request, process it //If a nonce was included in the request, process it
// if (requestNonce != null) { if (requestNonce != null) {
//
// //Check request nonce for reuse //Check request nonce for reuse
// Collection<Nonce> clientNonces = nonceService.getByClientId(client.getClientId()); Collection<Nonce> clientNonces = nonceService.getByClientId(client.getClientId());
// for (Nonce nonce : clientNonces) { for (Nonce nonce : clientNonces) {
// if (nonce.getValue().equals(requestNonce)) { if (nonce.getValue().equals(requestNonce)) {
// throw new NonceReuseException(client.getClientId(), nonce); throw new NonceReuseException(client.getClientId(), nonce);
// } }
// } }
//
// //Store nonce
// Nonce nonce = new Nonce();
// if (principal != null && !anonymous) { nonce.setClientId(client.getClientId());
// nonce.setValue(requestNonce);
// //Store nonce DateTime now = new DateTime(new Date());
// Nonce nonce = new Nonce(); nonce.setUseDate(now.toDate());
// nonce.setClientId(client.getClientId()); DateTime expDate = now.plus(nonceStorageDuration);
// nonce.setValue(requestNonce); Date expirationJdkDate = expDate.toDate();
// DateTime now = new DateTime(new Date()); nonce.setExpireDate(expirationJdkDate);
// nonce.setUseDate(now.toDate());
// DateTime expDate = now.plus(nonceStorageDuration); nonceService.save(nonce);
// Date expirationJdkDate = expDate.toDate(); }
// nonce.setExpireDate(expirationJdkDate);
//
// nonceService.save(nonce);
// }
// }
Set<String> scopes = OAuth2Utils.parseParameterList(parameters.get("scope")); Set<String> scopes = OAuth2Utils.parseParameterList(parameters.get("scope"));
if ((scopes == null || scopes.isEmpty())) { if ((scopes == null || scopes.isEmpty())) {