summaryrefslogtreecommitdiff
path: root/src/main/java/com/p4square/restlet/oauth/OAuthUser.java
blob: 11dbac1e783713112e7d4fc87fd4557dfcbb5a0f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
/*
 * Copyright 2013 Jesse Morgan
 */

package com.p4square.restlet.oauth;

import org.restlet.data.ChallengeResponse;
import org.restlet.security.User;

/**
 * Simple User object which also contains an OAuth AccessToken.
 *
 * @author Jesse Morgan <jesse@jesterpm.net>
 */
public class OAuthUser extends User {
    private final Token mToken;
    private final String mContentLocation;

    public OAuthUser(Token token) {
        this(null, token);
    }

    public OAuthUser(String location, Token token) {
        super();
        mToken = token;
        mContentLocation = location;
    }

    /**
     * @return the Location associated with the user.
     */
    public String getLocation() {
        return mContentLocation;
    }

    /**
     * @return The AccessToken.
     */
    public Token getToken() {
        return mToken;
    }

    /**
     * Convenience method for getToken().getChallengeResponse().
     * @return A ChallengeResponse based upon the access token.
     */
    public ChallengeResponse getChallengeResponse() {
        return mToken.getChallengeResponse();
    }
}