Examples of OAuthAccessorRecord


Examples of org.apache.roller.weblogger.pojos.OAuthAccessorRecord

            throw new OAuthException("ERROR storing accessor", ex);
        }
    }

    OAuthAccessor getAccessorByKey(String consumerKey) {
        OAuthAccessorRecord record = null;
        try {
            Query q = strategy.getNamedQuery("OAuthAccessorRecord.getByKey");
            q.setParameter(1, consumerKey);
            record = (OAuthAccessorRecord)q.getSingleResult();
View Full Code Here

Examples of org.apache.roller.weblogger.pojos.OAuthAccessorRecord

        }
        return accessorFromRecord(record);
    }

    OAuthAccessor getAccessorByToken(String token) {
        OAuthAccessorRecord record = null;
        try {
            Query q = strategy.getNamedQuery("OAuthAccessorRecord.getByToken");
            q.setParameter(1, token);
            record = (OAuthAccessorRecord)q.getSingleResult();
View Full Code Here

Examples of org.apache.roller.weblogger.pojos.OAuthAccessorRecord

     * Set the access token
     */
    public void markAsAuthorized(OAuthAccessor accessor, String userId)
            throws OAuthException {
        try {
            OAuthAccessorRecord record = (OAuthAccessorRecord) strategy.load(
                OAuthAccessorRecord.class, accessor.consumer.consumerKey);
            record.setUserName(userId);
            record.setAuthorized(Boolean.TRUE);
            strategy.store(record);
           
        } catch (WebloggerException ex) {
            throw new OAuthException("ERROR: setting authorization flag", ex);
        }
View Full Code Here

Examples of org.apache.roller.weblogger.pojos.OAuthAccessorRecord

        try {
            // generate oauth_token and oauth_secret
            // generate token and secret based on consumer_key
            String consumer_key = (String) accessor.consumer.consumerKey;

            OAuthAccessorRecord record = (OAuthAccessorRecord) strategy.load(
                OAuthAccessorRecord.class, accessor.consumer.consumerKey);
           
            // for now use md5 of name + current time as token
            String token_data = consumer_key + System.nanoTime();
            String token = DigestUtils.md5Hex(token_data);

            record.setRequestToken(null);
            record.setAccessToken(token);
            strategy.store(record);

        } catch (WebloggerException ex) {
            throw new OAuthException("ERROR: generating access token", ex);
        }
View Full Code Here

Examples of org.apache.roller.weblogger.pojos.OAuthAccessorRecord

        return consumerFromRecord(record);
    }

    void addAccessor(OAuthAccessor accessor) throws OAuthException {

        OAuthAccessorRecord record = new OAuthAccessorRecord();
        record.setConsumerKey(accessor.consumer.consumerKey);
        record.setRequestToken(accessor.requestToken);
        record.setAccessToken(accessor.accessToken);
        record.setTokenSecret(accessor.tokenSecret);
        if (accessor.getProperty("userId") != null) {
            record.setUserName((String)accessor.getProperty("userId"));
        }

        if (record.getCreated() != null) {
            record.setCreated(record.getCreated());
        } else {
            record.setCreated(new Timestamp(new Date().getTime()));
        }
       
        if (record.getUpdated() != null) {
            record.setUpdated(record.getUpdated());
        } else {
            record.setUpdated(record.getCreated());
        }

        if (accessor.getProperty("authorized") != null) {
            record.setAuthorized((Boolean)accessor.getProperty("authorized"));
        }
        try {
            strategy.store(record);
        } catch (WebloggerException ex) {
            throw new OAuthException("ERROR storing accessor", ex);
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.