Start line:  
End line:  

Snippet Preview

Snippet HTML Code

Stack Overflow Questions
 package edu.uiuc.ncsa.myproxy.oa4mp.oauth2.servlet;
 
 

Created by Jeff Gaynor
on 3/20/14 at 4:48 PM

public class OA2RegistrationServlet extends RegistrationServlet {
    public static final String CALLBACK_URI = "callbackURI";
    public static final String REFRESH_TOKEN_LIFETIME = "rtLifetime";
    @Override
    public void prepare(PresentableState statethrows Throwable {
        super.prepare(state);
        HttpServletRequest request = state.getRequest();
        if (state.getState() == ) {
            request.setAttribute();
        }
    }
    @Override
    protected Client addNewClient(HttpServletRequest requestHttpServletResponse responsethrows Throwable {
        OA2Client client = (OA2Clientsuper.addNewClient(requestresponse);
        String rawCBs = getRequiredParam(request);
        String rawRTLifetime = getRequiredParam(request);
        long clientRtLifetime = 0L;
        boolean rtLifetimeOK = true;
        if (rawRTLifetime != null && 0 < rawRTLifetime.length()) {
            try {
                clientRtLifetime = Long.parseLong(rawRTLifetime);
                if (clientRtLifetime < 0) {
                    rtLifetimeOK = false;
                } else {
                    rtLifetimeOK = true;
                }
            } catch (Throwable t) {
                // do nix...
                rtLifetimeOK = false;
            }
            if (!rtLifetimeOK) {
                info("Client requested illegal value for refresh token lifetime at registration of \"" + rawRTLifetime + "\"");
            }
        }
        client.setRtLifetime(clientRtLifetime);
        BufferedReader br = new BufferedReader(new StringReader(rawCBs));
        String x = br.readLine();
        LinkedList<Stringuris = new LinkedList<>();
        while (x != null) {
            try {
                URI.create(x);
                uris.add(x);
            } catch (Throwable t) {
                // skip it.
                warn("Attempt to add bad callback uri for client " + client.getIdentifierString());
            }
            x = br.readLine();
        }
        br.close();
        client.setCallbackURIs(uris);
        getServiceEnvironment().getClientStore().save(client);
        return client;
    }
New to GrepCode? Check out our FAQ X