Search in sources :

Example 1 with TokenForge

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

the class ClientLoader method createInstance.

@Override
public T createInstance() {
    Provider<TokenForge> tokenForgeProvider = new Provider<TokenForge>() {

        @Override
        public TokenForge get() {
            return new OAuthTokenForge(getId());
        }
    };
    Provider<Client> clientProvider = new Provider<Client>() {

        @Override
        public Client get() {
            OAClient c = new OAClient(BasicIdentifier.newID(getId()));
            c.setSignatureMethod(OAuthConstants.RSA_SHA1);
            c.setCreationTS(new Date());
            return c;
        }
    };
    // sets constants specific to this protocol.
    HashMap<String, String> constants = new HashMap<String, String>();
    constants.put(CALLBACK_URI_KEY, OAuthConstants.OAUTH_CALLBACK);
    constants.put(ClientEnvironment.FORM_ENCODING, "UTF-8");
    constants.put(ClientEnvironment.TOKEN, OAuth.OAUTH_TOKEN);
    constants.put(ClientEnvironment.VERIFIER, OAuth.OAUTH_VERIFIER);
    return createInstance(tokenForgeProvider, clientProvider, constants);
}
Also used : OAuthTokenForge(edu.uiuc.ncsa.security.oauth_1_0a.OAuthTokenForge) TokenForge(edu.uiuc.ncsa.security.delegation.token.TokenForge) OAClient(edu.uiuc.ncsa.security.oauth_1_0a.client.OAClient) HashMap(java.util.HashMap) Client(edu.uiuc.ncsa.security.delegation.storage.Client) OAClient(edu.uiuc.ncsa.security.oauth_1_0a.client.OAClient) OAuthTokenForge(edu.uiuc.ncsa.security.oauth_1_0a.OAuthTokenForge) Date(java.util.Date) Provider(javax.inject.Provider) AssetProvider(edu.uiuc.ncsa.myproxy.oa4mp.client.storage.AssetProvider) DelegationServiceImplProvider(edu.uiuc.ncsa.security.oauth_1_0a.client.DelegationServiceImplProvider) OA4MPServiceProvider(edu.uiuc.ncsa.myproxy.oa4mp.client.OA4MPServiceProvider)

Example 2 with TokenForge

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

the class TokenTest method testToken.

@Test
public void testToken() throws Exception {
    TokenForge tf = getTSProvider().getTokenForge();
    System.out.println("AT = " + tf.getAccessToken());
    System.out.println("AG = " + tf.getAuthorizationGrant());
    System.out.println("V = " + tf.getVerifier());
}
Also used : TokenForge(edu.uiuc.ncsa.security.delegation.token.TokenForge) Test(org.junit.Test)

Aggregations

TokenForge (edu.uiuc.ncsa.security.delegation.token.TokenForge)2 OA4MPServiceProvider (edu.uiuc.ncsa.myproxy.oa4mp.client.OA4MPServiceProvider)1 AssetProvider (edu.uiuc.ncsa.myproxy.oa4mp.client.storage.AssetProvider)1 Client (edu.uiuc.ncsa.security.delegation.storage.Client)1 OAuthTokenForge (edu.uiuc.ncsa.security.oauth_1_0a.OAuthTokenForge)1 DelegationServiceImplProvider (edu.uiuc.ncsa.security.oauth_1_0a.client.DelegationServiceImplProvider)1 OAClient (edu.uiuc.ncsa.security.oauth_1_0a.client.OAClient)1 Date (java.util.Date)1 HashMap (java.util.HashMap)1 Provider (javax.inject.Provider)1 Test (org.junit.Test)1