Search in sources :

Example 1 with TransactionNotFoundException

use of edu.uiuc.ncsa.security.core.exceptions.TransactionNotFoundException in project OA4MP by ncsa.

the class AccessTokenServlet method verifyAndGet.

@Override
public ServiceTransaction verifyAndGet(IssuerResponse iResponse) throws IOException {
    ATResponse atResponse = (ATResponse) iResponse;
    Verifier verifier = atResponse.getVerifier();
    debug("5.a. verifier = " + atResponse.getVerifier());
    checkTimestamp(verifier.getToken());
    ServiceTransaction transaction = (ServiceTransaction) getTransactionStore().get(verifier);
    if (transaction == null) {
        throw new TransactionNotFoundException("No transaction found for verifier " + verifier);
    }
    checkClientApproval(transaction.getClient());
    String cc = "client=" + transaction.getClient().getIdentifierString();
    info("5.a. " + cc);
    debug("5.a. grant valid=" + transaction.isAuthGrantValid() + ", at valid=" + transaction.isAccessTokenValid());
    if (!transaction.isAuthGrantValid() || transaction.isAccessTokenValid()) {
        String msg = "Error: the state of the transaction is invalid for auth grant " + transaction.getAuthorizationGrant();
        warn(msg);
        throw new GeneralException(msg);
    }
    return transaction;
}
Also used : GeneralException(edu.uiuc.ncsa.security.core.exceptions.GeneralException) ServiceTransaction(edu.uiuc.ncsa.security.delegation.server.ServiceTransaction) TransactionNotFoundException(edu.uiuc.ncsa.security.core.exceptions.TransactionNotFoundException) Verifier(edu.uiuc.ncsa.security.delegation.token.Verifier) ATResponse(edu.uiuc.ncsa.security.delegation.server.request.ATResponse)

Aggregations

GeneralException (edu.uiuc.ncsa.security.core.exceptions.GeneralException)1 TransactionNotFoundException (edu.uiuc.ncsa.security.core.exceptions.TransactionNotFoundException)1 ServiceTransaction (edu.uiuc.ncsa.security.delegation.server.ServiceTransaction)1 ATResponse (edu.uiuc.ncsa.security.delegation.server.request.ATResponse)1 Verifier (edu.uiuc.ncsa.security.delegation.token.Verifier)1