~mardy/ubuntuone-credentials/fix-token-tests

« back to all changes in this revision

Viewing changes to libubuntuoneauth/token.cpp

  • Committer: CI Train Bot
  • Author(s): Alberto Mardegan
  • Date: 2016-04-27 20:33:34 UTC
  • mfrom: (236.2.7 signon-plugin-part1)
  • Revision ID: ci-train-bot@canonical.com-20160427203334-3txey8wh3clzw9cw
Complete the UbuntuOne authentication plugin

Implement the UbuntuOne authentication inside the signon plugin, with UI interactions delegated to the signon UI (currently implemented in the ubuntu-system-settings-online-accounts project).

Show diffs side-by-side

added added

removed removed

Lines of Context:
97
97
    }
98
98
 
99
99
    /**
 
100
     * \fn QString Token::name()
 
101
     *
 
102
     * Returns the token name, or empty string if not set.
 
103
     */
 
104
    QString Token::name() const
 
105
    {
 
106
        return _tokenHash.value(TOKEN_NAME_KEY, "");
 
107
    }
 
108
 
 
109
    /**
100
110
     * \fn QString Token::consumerKey()
101
111
     *
102
 
     * Retruns a consumer key for this token, or empty string if consumer key is not set.
 
112
     * Returns a consumer key for this token, or empty string if consumer key is not set.
103
113
     */
104
114
    QString Token::consumerKey() const
105
115
    {
107
117
    }
108
118
 
109
119
    /**
 
120
     * \fn QString Token::consumerSecret()
 
121
     *
 
122
     * Returns a consumer secret for this token, or empty string if not set.
 
123
     */
 
124
    QString Token::consumerSecret() const
 
125
    {
 
126
        return _tokenHash.value(TOKEN_CONSUMER_SEC_KEY, "");
 
127
    }
 
128
 
 
129
    /**
 
130
     * \fn QString Token::tokenKey()
 
131
     *
 
132
     * Returns a token key for this token, or empty string if token key is not set.
 
133
     */
 
134
    QString Token::tokenKey() const
 
135
    {
 
136
        return _tokenHash.value(TOKEN_TOKEN_KEY, "");
 
137
    }
 
138
 
 
139
    /**
 
140
     * \fn QString Token::tokenSecret()
 
141
     *
 
142
     * Returns a token secret for this token, or empty string if not set.
 
143
     */
 
144
    QString Token::tokenSecret() const
 
145
    {
 
146
        return _tokenHash.value(TOKEN_TOKEN_SEC_KEY, "");
 
147
    }
 
148
 
 
149
    /**
110
150
     * \fn bool Token::isValid()
111
151
     *
112
152
     * Check that the token is valid.
295
335
        QStringList params = query.split("&");
296
336
        for (int i = 0; i < params.size(); ++i) {
297
337
            QStringList pair = params.at(i).split("=");
 
338
            if (pair.count() < 2) {
 
339
                continue;
 
340
            }
298
341
            if (pair.at(0) == TOKEN_NAME_KEY) {
299
342
                // TODO: Need to figure out how to actually use the
300
343
                // QUrl::fromPercentEncoding at this point in the code.