/
WechatProfile.java
54 lines (45 loc) · 1.42 KB
/
WechatProfile.java
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
51
52
53
54
package org.pac4j.oauth.profile.wechat;
import lombok.val;
import org.pac4j.core.profile.Gender;
import org.pac4j.oauth.profile.OAuth20Profile;
import java.io.Serial;
import java.net.URI;
/**
* <p>This class is the user profile for Tencent Wechat with appropriate getters.</p>
* <p>It is returned by the {@link org.pac4j.oauth.client.WechatClient}.</p>
*
* @author zhangzhenli
* @since 3.1.0
*/
public class WechatProfile extends OAuth20Profile {
@Serial
private static final long serialVersionUID = 2576512203937798654L;
/** {@inheritDoc} */
@Override
public String getDisplayName() {
return (String) getAttribute(WechatProfileDefinition.NICKNAME);
}
/** {@inheritDoc} */
@Override
public String getUsername() {
return (String) getAttribute(WechatProfileDefinition.NICKNAME);
}
/** {@inheritDoc} */
@Override
public Gender getGender() {
return (Gender) getAttribute(WechatProfileDefinition.SEX);
}
/** {@inheritDoc} */
@Override
public String getLocation() {
val location = getAttribute(WechatProfileDefinition.CITY) + ","
+ getAttribute(WechatProfileDefinition.PROVINCE) + ","
+ getAttribute(WechatProfileDefinition.COUNTRY);
return location;
}
/** {@inheritDoc} */
@Override
public URI getPictureUrl() {
return (URI) getAttribute(WechatProfileDefinition.HEADIMGURL);
}
}