本文整理汇总了Java中org.pac4j.oauth.profile.JsonHelper类的典型用法代码示例。如果您正苦于以下问题:Java JsonHelper类的具体用法?Java JsonHelper怎么用?Java JsonHelper使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
JsonHelper类属于org.pac4j.oauth.profile包,在下文中一共展示了JsonHelper类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: extractUserProfile
import org.pac4j.oauth.profile.JsonHelper; //导入依赖的package包/类
@Override
public FacebookProfile extractUserProfile(final String body) throws HttpAction {
final FacebookProfile profile = newProfile();
final JsonNode json = JsonHelper.getFirstNode(body);
if (json != null) {
profile.setId(JsonHelper.getElement(json, "id"));
for (final String attribute : getPrimaryAttributes()) {
convertAndAdd(profile, attribute, JsonHelper.getElement(json, attribute));
}
extractData(profile, json, org.pac4j.oauth.profile.facebook.FacebookProfileDefinition.FRIENDS);
extractData(profile, json, org.pac4j.oauth.profile.facebook.FacebookProfileDefinition.MOVIES);
extractData(profile, json, org.pac4j.oauth.profile.facebook.FacebookProfileDefinition.MUSIC);
extractData(profile, json, org.pac4j.oauth.profile.facebook.FacebookProfileDefinition.BOOKS);
extractData(profile, json, org.pac4j.oauth.profile.facebook.FacebookProfileDefinition.LIKES);
extractData(profile, json, org.pac4j.oauth.profile.facebook.FacebookProfileDefinition.ALBUMS);
extractData(profile, json, org.pac4j.oauth.profile.facebook.FacebookProfileDefinition.EVENTS);
extractData(profile, json, org.pac4j.oauth.profile.facebook.FacebookProfileDefinition.GROUPS);
extractData(profile, json, org.pac4j.oauth.profile.facebook.FacebookProfileDefinition.MUSIC_LISTENS);
extractData(profile, json, org.pac4j.oauth.profile.facebook.FacebookProfileDefinition.PICTURE);
}
return profile;
}
开发者ID:millross,项目名称:pac4j-async,代码行数:23,代码来源:FacebookProfileDefinition.java
示例2: extractUserProfile
import org.pac4j.oauth.profile.JsonHelper; //导入依赖的package包/类
@Override
protected FacebookProfile extractUserProfile(final String body) throws HttpAction {
final FacebookProfile profile = new FacebookProfile();
final JsonNode json = JsonHelper.getFirstNode(body);
if (json != null) {
profile.setId(JsonHelper.getElement(json, "id"));
for (final String attribute : profile.getAttributesDefinition().getPrimaryAttributes()) {
profile.addAttribute(attribute, JsonHelper.getElement(json, attribute));
}
extractData(profile, json, FacebookAttributesDefinition.FRIENDS);
extractData(profile, json, FacebookAttributesDefinition.MOVIES);
extractData(profile, json, FacebookAttributesDefinition.MUSIC);
extractData(profile, json, FacebookAttributesDefinition.BOOKS);
extractData(profile, json, FacebookAttributesDefinition.LIKES);
extractData(profile, json, FacebookAttributesDefinition.ALBUMS);
extractData(profile, json, FacebookAttributesDefinition.EVENTS);
extractData(profile, json, FacebookAttributesDefinition.GROUPS);
extractData(profile, json, FacebookAttributesDefinition.MUSIC_LISTENS);
extractData(profile, json, FacebookAttributesDefinition.PICTURE);
}
return profile;
}
开发者ID:yaochi,项目名称:pac4j-plus,代码行数:23,代码来源:FacebookClient.java
示例3: extractUserProfile
import org.pac4j.oauth.profile.JsonHelper; //导入依赖的package包/类
@Override
protected FoursquareProfile extractUserProfile(String body) throws HttpAction {
FoursquareProfile profile = new FoursquareProfile();
JsonNode json = JsonHelper.getFirstNode(body);
if (json == null) {
return profile;
}
JsonNode response = (JsonNode) JsonHelper.getElement(json, "response");
if (response == null) {
return profile;
}
JsonNode user = (JsonNode) JsonHelper.getElement(response, "user");
if (user != null) {
profile.setId(JsonHelper.getElement(user, "id"));
for (final String attribute : profile.getAttributesDefinition().getPrimaryAttributes()) {
profile.addAttribute(attribute, JsonHelper.getElement(user, attribute));
}
}
return profile;
}
开发者ID:yaochi,项目名称:pac4j-plus,代码行数:22,代码来源:FoursquareClient.java
示例4: extractUserProfile
import org.pac4j.oauth.profile.JsonHelper; //导入依赖的package包/类
@Override
protected LinkedIn2Profile extractUserProfile(final String body) throws HttpAction {
LinkedIn2Profile profile = new LinkedIn2Profile();
final JsonNode json = JsonHelper.getFirstNode(body);
profile.setId(JsonHelper.getElement(json, "id"));
for (final String attribute : profile.getAttributesDefinition().getPrimaryAttributes()) {
profile.addAttribute(attribute, JsonHelper.getElement(json, attribute));
}
final Object positions = JsonHelper.getElement(json, LinkedIn2AttributesDefinition.POSITIONS);
if (positions != null && positions instanceof JsonNode) {
profile.addAttribute(LinkedIn2AttributesDefinition.POSITIONS, JsonHelper.getElement((JsonNode) positions, "values"));
}
addUrl(profile, json, LinkedIn2AttributesDefinition.SITE_STANDARD_PROFILE_REQUEST);
addUrl(profile, json, LinkedIn2AttributesDefinition.API_STANDARD_PROFILE_REQUEST);
return profile;
}
开发者ID:yaochi,项目名称:pac4j-plus,代码行数:17,代码来源:LinkedIn2Client.java
示例5: buildUserRoles
import org.pac4j.oauth.profile.JsonHelper; //导入依赖的package包/类
/**
* Builds a list of Revenue Sharing roles according to the roles retrieved
* from the idm and the email of the user
* @param rolesNode, A JSON array containing the roles provided by the idm
* @param email, Email of the user
* @return List of revenue sharing roles
*/
public List<Role> buildUserRoles(ArrayNode rolesNode, String email) {
List<Role> userRoles = new ArrayList<>();
// Include idm defined roles
for (JsonNode node : rolesNode) {
Role r = new Role();
String role = (String) JsonHelper.get(node, "name");
r.setId((String) JsonHelper.get(node, "id"));
r.setName(role.toLowerCase());
userRoles.add(r);
}
// Check aggregator role
if (this.aggregatorDao.getById(email) != null) {
Role ag = new Role();
ag.setId("0");
ag.setName("aggregator");
userRoles.add(ag);
}
return userRoles;
}
开发者ID:conwetlab,项目名称:fiware-rss,代码行数:31,代码来源:AuthUserManager.java
示例6: extractUserProfile
import org.pac4j.oauth.profile.JsonHelper; //导入依赖的package包/类
protected WeiXinProfile extractUserProfile(String body) {
WeiXinProfile profile = new WeiXinProfile();
JsonNode json = JsonHelper.getFirstNode(body);
if(json != null) {
Iterator var4 = WeiXinAttributesDefinition.weixinDefinition.getAllAttributes().iterator();
while(var4.hasNext()) {
String attribute = (String)var4.next();
profile.addAttribute(attribute, JsonHelper.get(json, attribute));
}
}
return profile;
}
开发者ID:luotuo,项目名称:cas4.0.x-server-wechat,代码行数:13,代码来源:WeiXinClientOauth.java
示例7: convert
import org.pac4j.oauth.profile.JsonHelper; //导入依赖的package包/类
public Object convert(final Object attribute) {
if (attribute != null) {
if (attribute instanceof String) {
return parseString((String) attribute, arrayClazz);
} else if (attribute instanceof JsonNode) {
return JsonHelper.getAsType((JsonNode) attribute, arrayClazz);
} else if (attribute instanceof List) {
final List list = (List) attribute;
final List newList = new ArrayList<>();
for (final Object o : list) {
if (o != null) {
if (o instanceof String) {
final String s = (String) o;
if (elementClazz.isAssignableFrom(String.class)) {
newList.add(s);
} else {
newList.add(parseString(s, elementClazz));
}
} else if (o.getClass().isAssignableFrom(elementClazz)) {
newList.add(o);
}
}
}
return newList;
}
}
return null;
}
开发者ID:yaochi,项目名称:pac4j-plus,代码行数:29,代码来源:JsonListConverter.java
示例8: convert
import org.pac4j.oauth.profile.JsonHelper; //导入依赖的package包/类
public T convert(final Object attribute) {
if (attribute != null) {
if (attribute.getClass().isAssignableFrom(clazz)) {
return (T) attribute;
} else if (attribute instanceof String) {
final JsonNode node = JsonHelper.getFirstNode((String) attribute);
return JsonHelper.getAsType(node, clazz);
} else if (attribute instanceof JsonNode) {
final T ret = JsonHelper.getAsType((JsonNode) attribute, clazz);
return ret;
}
}
return null;
}
开发者ID:yaochi,项目名称:pac4j-plus,代码行数:15,代码来源:JsonConverter.java
示例9: extractUserProfile
import org.pac4j.oauth.profile.JsonHelper; //导入依赖的package包/类
@Override
protected QQProfile extractUserProfile(final String body) throws HttpAction {
final QQProfile profile = new QQProfile();
final JsonNode json = JsonHelper.getFirstNode(body);
if (json != null) {
profile.setId(JsonHelper.getElement(json, "id"));
for (final String attribute : profile.getAttributesDefinition().getPrimaryAttributes()) {
profile.addAttribute(attribute, JsonHelper.getElement(json, attribute));
}
}
return profile;
}
开发者ID:yaochi,项目名称:pac4j-plus,代码行数:13,代码来源:QQClient.java
示例10: extractUserProfile
import org.pac4j.oauth.profile.JsonHelper; //导入依赖的package包/类
@Override
protected YahooProfile extractUserProfile(final String body) throws HttpAction {
final YahooProfile profile = new YahooProfile();
JsonNode json = JsonHelper.getFirstNode(body);
if (json != null) {
json = json.get("profile");
if (json != null) {
profile.setId(JsonHelper.getElement(json, "guid"));
for (final String attribute : profile.getAttributesDefinition().getPrimaryAttributes()) {
profile.addAttribute(attribute, JsonHelper.getElement(json, attribute));
}
}
}
return profile;
}
开发者ID:yaochi,项目名称:pac4j-plus,代码行数:16,代码来源:YahooClient.java
示例11: extractUserProfile
import org.pac4j.oauth.profile.JsonHelper; //导入依赖的package包/类
@Override
protected GenericOAuth20Profile extractUserProfile(String body) {
final GenericOAuth20Profile profile = new GenericOAuth20Profile();
if (attributesDefinition != null) {
profile.setAttributesDefinition(attributesDefinition);
}
final JsonNode json = JsonHelper.getFirstNode(body);
if (json != null) {
profile.setId(JsonHelper.getElement(json, "id"));
for (final String attribute : profile.getAttributesDefinition().getPrimaryAttributes()) {
profile.addAttribute(attribute, JsonHelper.getElement(json, attribute));
}
}
return profile;
}
开发者ID:yaochi,项目名称:pac4j-plus,代码行数:16,代码来源:GenericOAuth20Client.java
示例12: extractUserProfile
import org.pac4j.oauth.profile.JsonHelper; //导入依赖的package包/类
@Override
protected StravaProfile extractUserProfile(String body) throws HttpAction {
final StravaProfile profile = new StravaProfile();
final JsonNode json = JsonHelper.getFirstNode(body);
if (json != null) {
profile.setId(JsonHelper.getElement(json, StravaAttributesDefinition.ID));
for (final String attribute : profile.getAttributesDefinition().getPrimaryAttributes()) {
profile.addAttribute(attribute, JsonHelper.getElement(json, attribute));
}
}
return profile;
}
开发者ID:yaochi,项目名称:pac4j-plus,代码行数:13,代码来源:StravaClient.java
示例13: extractUserProfile
import org.pac4j.oauth.profile.JsonHelper; //导入依赖的package包/类
@Override
protected WindowsLiveProfile extractUserProfile(final String body) throws HttpAction {
final WindowsLiveProfile profile = new WindowsLiveProfile();
final JsonNode json = JsonHelper.getFirstNode(body);
if (json != null) {
profile.setId(JsonHelper.getElement(json, "id"));
for (final String attribute : profile.getAttributesDefinition().getPrimaryAttributes()) {
profile.addAttribute(attribute, JsonHelper.getElement(json, attribute));
}
}
return profile;
}
开发者ID:yaochi,项目名称:pac4j-plus,代码行数:13,代码来源:WindowsLiveClient.java
示例14: extractUserProfile
import org.pac4j.oauth.profile.JsonHelper; //导入依赖的package包/类
@Override
protected OkProfile extractUserProfile(String body) throws HttpAction {
final OkProfile profile = new OkProfile();
JsonNode userNode = JsonHelper.getFirstNode(body);
if (userNode != null) {
profile.setId(JsonHelper.getElement(userNode, OkAttributesDefinition.UID));
for (final String attribute : profile.getAttributesDefinition().getPrimaryAttributes()) {
profile.addAttribute(attribute, JsonHelper.getElement(userNode, attribute));
}
}
return profile;
}
开发者ID:yaochi,项目名称:pac4j-plus,代码行数:13,代码来源:OkClient.java
示例15: extractUserProfile
import org.pac4j.oauth.profile.JsonHelper; //导入依赖的package包/类
@Override
protected CasOAuthWrapperProfile extractUserProfile(final String body) throws HttpAction {
final CasOAuthWrapperProfile userProfile = new CasOAuthWrapperProfile();
JsonNode json = JsonHelper.getFirstNode(body);
if (json != null) {
userProfile.setId(JsonHelper.getElement(json, "id"));
json = json.get("attributes");
if (json != null) {
// CAS <= v4.2
if (json instanceof ArrayNode) {
final Iterator<JsonNode> nodes = json.iterator();
while (nodes.hasNext()) {
json = nodes.next();
final String attribute = json.fieldNames().next();
userProfile.addAttribute(attribute, JsonHelper.getElement(json, attribute));
}
// CAS v5
} else if (json instanceof ObjectNode) {
final Iterator<String> keys = json.fieldNames();
while (keys.hasNext()) {
final String key = keys.next();
userProfile.addAttribute(key, JsonHelper.getElement(json, key));
}
}
}
}
return userProfile;
}
开发者ID:yaochi,项目名称:pac4j-plus,代码行数:29,代码来源:CasOAuthWrapperClient.java
示例16: extractUserProfile
import org.pac4j.oauth.profile.JsonHelper; //导入依赖的package包/类
@Override
protected PayPalProfile extractUserProfile(final String body) throws HttpAction {
final PayPalProfile profile = new PayPalProfile();
final JsonNode json = JsonHelper.getFirstNode(body);
if (json != null) {
final String userId = (String) JsonHelper.getElement(json, "user_id");
profile.setId(CommonHelper.substringAfter(userId, "/user/"));
for (final String attribute : profile.getAttributesDefinition().getPrimaryAttributes()) {
profile.addAttribute(attribute, JsonHelper.getElement(json, attribute));
}
}
return profile;
}
开发者ID:yaochi,项目名称:pac4j-plus,代码行数:14,代码来源:PayPalClient.java
示例17: extractUserProfile
import org.pac4j.oauth.profile.JsonHelper; //导入依赖的package包/类
@Override
protected SinaProfile extractUserProfile(final String body) throws HttpAction {
final SinaProfile profile = new SinaProfile();
final JsonNode json = JsonHelper.getFirstNode(body);
if (json != null) {
profile.setId(JsonHelper.getElement(json, "id"));
for (final String attribute : profile.getAttributesDefinition().getPrimaryAttributes()) {
profile.addAttribute(attribute, JsonHelper.getElement(json, attribute));
}
}
return profile;
}
开发者ID:yaochi,项目名称:pac4j-plus,代码行数:13,代码来源:SinaClient.java
示例18: extractUserProfile
import org.pac4j.oauth.profile.JsonHelper; //导入依赖的package包/类
@Override
protected TwitterProfile extractUserProfile(final String body) throws HttpAction {
final TwitterProfile profile = new TwitterProfile();
final JsonNode json = JsonHelper.getFirstNode(body);
if (json != null) {
profile.setId(JsonHelper.getElement(json, "id"));
for (final String attribute : profile.getAttributesDefinition().getPrimaryAttributes()) {
profile.addAttribute(attribute, JsonHelper.getElement(json, attribute));
}
}
return profile;
}
开发者ID:yaochi,项目名称:pac4j-plus,代码行数:13,代码来源:TwitterClient.java
示例19: extractUserProfile
import org.pac4j.oauth.profile.JsonHelper; //导入依赖的package包/类
@Override
protected VkProfile extractUserProfile(final String body) throws HttpAction {
final VkProfile profile = new VkProfile();
JsonNode json = JsonHelper.getFirstNode(body);
if (json != null) {
ArrayNode array = (ArrayNode) json.get("response");
JsonNode userNode = array.get(0);
profile.setId(JsonHelper.getElement(userNode, "uid"));
for (final String attribute : profile.getAttributesDefinition().getPrimaryAttributes()) {
profile.addAttribute(attribute, JsonHelper.getElement(userNode, attribute));
}
}
return profile;
}
开发者ID:yaochi,项目名称:pac4j-plus,代码行数:15,代码来源:VkClient.java
示例20: extractUserProfile
import org.pac4j.oauth.profile.JsonHelper; //导入依赖的package包/类
@Override
protected GitHubProfile extractUserProfile(final String body) throws HttpAction {
final GitHubProfile profile = new GitHubProfile();
final JsonNode json = JsonHelper.getFirstNode(body);
if (json != null) {
profile.setId(JsonHelper.getElement(json, "id"));
for (final String attribute : profile.getAttributesDefinition().getPrimaryAttributes()) {
profile.addAttribute(attribute, JsonHelper.getElement(json, attribute));
}
}
return profile;
}
开发者ID:yaochi,项目名称:pac4j-plus,代码行数:13,代码来源:GitHubClient.java
注:本文中的org.pac4j.oauth.profile.JsonHelper类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论