Search in sources :

Example 6 with AuthorizationGrant

use of edu.uiuc.ncsa.security.delegation.token.AuthorizationGrant in project OA4MP by ncsa.

the class TransactionStoreTest method newAG.

protected AuthorizationGrant newAG(String... x) {
    AuthorizationGrant ag = getTSProvider().getTokenForge().getAuthorizationGrant(x);
    // The forge may return a shared secret. Since we never use this in OA4MP, make sure it is null
    // or you will get false test results since the secret won't be stored.
    ag.setSharedSecret(null);
    return ag;
}
Also used : AuthorizationGrant(edu.uiuc.ncsa.security.delegation.token.AuthorizationGrant)

Example 7 with AuthorizationGrant

use of edu.uiuc.ncsa.security.delegation.token.AuthorizationGrant in project OA4MP by ncsa.

the class AbstractAuthorizationServlet method getAndCheckTransaction.

/*
         Get the transaction associated with the authorization grant token and check that it passes sanity
         checks. If so, return it, If not, throw the appropriate exception.
     */
protected ServiceTransaction getAndCheckTransaction(String token) throws IOException {
    DateUtils.checkTimestamp(token);
    AuthorizationGrant grant = MyProxyDelegationServlet.getServiceEnvironment().getTokenForge().getAuthorizationGrant(token);
    ServiceTransaction trans = MyProxyDelegationServlet.getServiceEnvironment().getTransactionStore().get(grant);
    if (trans == null) {
        warn("Error: no delegation request found for " + token);
        throw new GeneralException("Error: no delegation request found.");
    }
    checkClientApproval(trans.getClient());
    return trans;
}
Also used : GeneralException(edu.uiuc.ncsa.security.core.exceptions.GeneralException) ServiceTransaction(edu.uiuc.ncsa.security.delegation.server.ServiceTransaction) AuthorizationGrant(edu.uiuc.ncsa.security.delegation.token.AuthorizationGrant)

Example 8 with AuthorizationGrant

use of edu.uiuc.ncsa.security.delegation.token.AuthorizationGrant in project OA4MP by ncsa.

the class AuthorizedServlet method getAndCheckTransaction.

/*
   Get the transaction associated with the authorization grant token and check that it passes sanity
   checks. If so, return it, If not, throw the appropriate exception.
*/
protected ServiceTransaction getAndCheckTransaction(ProtocolParameters p) throws Throwable {
    String token = p.token;
    DateUtils.checkTimestamp(token);
    AuthorizationGrant grant = MyProxyDelegationServlet.getServiceEnvironment().getTokenForge().getAuthorizationGrant(token);
    checkTimestamp(grant.getToken());
    ServiceTransaction trans = MyProxyDelegationServlet.getServiceEnvironment().getTransactionStore().get(grant);
    if (trans == null) {
        warn("Error: no delegation request found for " + token);
        throw new GeneralException("Error: no delegation request found.");
    }
    checkClientApproval(trans.getClient());
    return trans;
}
Also used : GeneralException(edu.uiuc.ncsa.security.core.exceptions.GeneralException) ServiceTransaction(edu.uiuc.ncsa.security.delegation.server.ServiceTransaction) AuthorizationGrant(edu.uiuc.ncsa.security.delegation.token.AuthorizationGrant)

Aggregations

AuthorizationGrant (edu.uiuc.ncsa.security.delegation.token.AuthorizationGrant)8 GeneralException (edu.uiuc.ncsa.security.core.exceptions.GeneralException)4 ServiceTransaction (edu.uiuc.ncsa.security.delegation.server.ServiceTransaction)3 Verifier (edu.uiuc.ncsa.security.delegation.token.Verifier)2 AssetResponse (edu.uiuc.ncsa.myproxy.oa4mp.client.AssetResponse)1 OA2ServiceTransaction (edu.uiuc.ncsa.myproxy.oa4mp.oauth2.OA2ServiceTransaction)1 RefreshTokenStore (edu.uiuc.ncsa.myproxy.oa4mp.oauth2.storage.RefreshTokenStore)1 OA2Asset (edu.uiuc.ncsa.oa4mp.oauth2.client.OA2Asset)1 OA2MPService (edu.uiuc.ncsa.oa4mp.oauth2.client.OA2MPService)1 Identifier (edu.uiuc.ncsa.security.core.Identifier)1 BasicIdentifier (edu.uiuc.ncsa.security.core.util.BasicIdentifier)1 ATRequest (edu.uiuc.ncsa.security.delegation.server.request.ATRequest)1 ATResponse (edu.uiuc.ncsa.security.delegation.server.request.ATResponse)1 TransactionState (edu.uiuc.ncsa.security.delegation.servlet.TransactionState)1 RefreshToken (edu.uiuc.ncsa.security.delegation.token.RefreshToken)1 AuthorizationGrantImpl (edu.uiuc.ncsa.security.delegation.token.impl.AuthorizationGrantImpl)1 OA2RedirectableError (edu.uiuc.ncsa.security.oauth_2_0.OA2RedirectableError)1 OA2TokenForge (edu.uiuc.ncsa.security.oauth_2_0.OA2TokenForge)1 UserInfo (edu.uiuc.ncsa.security.oauth_2_0.UserInfo)1 ATResponse2 (edu.uiuc.ncsa.security.oauth_2_0.client.ATResponse2)1