That method will be called by CXF AuthorizationCodeGrantService - do try to run the demo

Cheers, Sergey
On 03/08/16 11:35, gaurang wrote:
Thanks, Sergey for helping me.
With help of the example i have created a small code in which i am just
registering a thirdPartyApplication to get the authorisation code grant.


public class OauthManager implements AuthorizationCodeDataProvider {

        private Client client;
        private ServerAuthorizationCodeGrant grant;

        public void registerClient(Client client2) {
                this.client = client2;
                System.out.println("registerClient called : " + client);
        }

        @Override
        public Client getClient(String clientId) throws OAuthServiceException {
                System.out.println("get client called");
                return client == null || !client.getClientId().equals(clientId) 
? null :
client;
        }

        public ServerAuthorizationCodeGrant
createCodeGrant(AuthorizationCodeRegistration reg)
                        throws OAuthServiceException {
                grant = new ServerAuthorizationCodeGrant(client, 3600L);
//ServerAuthorizationCodeGrant(Client client, long lifetime)
                grant.setRedirectUri(reg.getRedirectUri());
                System.out.println("issued at : "+ grant.getIssuedAt() + "expires in 
: "
+grant.getExpiresIn()  );
                return grant;
        }


this is the code for generating authorisation code to register app.

How to call method createCodeGrant??




--
View this message in context: 
http://cxf.547215.n5.nabble.com/OAuth2-filter-using-CXF-tp5770940p5771005.html
Sent from the cxf-user mailing list archive at Nabble.com.



--
Sergey Beryozkin

Talend Community Coders
http://coders.talend.com/

Reply via email to