本文整理汇总了Java中org.sunbird.services.sso.SSOManager类的典型用法代码示例。如果您正苦于以下问题:Java SSOManager类的具体用法?Java SSOManager怎么用?Java SSOManager使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
SSOManager类属于org.sunbird.services.sso包,在下文中一共展示了SSOManager类的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: verifyUserAccesToken
import org.sunbird.services.sso.SSOManager; //导入依赖的package包/类
/**
* This method will verify the incoming user access token against store data base /cache. If token
* is valid then it would be associated with some user id. In case of token matched it will
* provide user id. else will provide empty string.
* @param token String
* @return String
*/
@SuppressWarnings("unchecked")
public static String verifyUserAccesToken(String token) {
SSOManager ssoManager = SSOServiceFactory.getInstance();
String userId = "";
try {
boolean response = Boolean.parseBoolean(PropertiesCache.getInstance().getProperty(JsonKey.IS_SSO_ENABLED));
if (response) {
userId = ssoManager.verifyToken(token);
} else {
Response authResponse = cassandraOperation.getRecordById(userAuth.getKeySpace(), userAuth.getTableName(), token);
if(authResponse != null && authResponse.get(JsonKey.RESPONSE) != null) {
List<Map<String, Object>> authList =
(List<Map<String, Object>>) authResponse.get(JsonKey.RESPONSE);
if (authList != null && authList.size()>0) {
Map<String,Object> authMap = authList.get(0);
userId = (String) authMap.get(JsonKey.USER_ID);
}
}
}
} catch (Exception e) {
ProjectLogger.log("invalid auth token =" + token, e);
}
return userId;
}
示例2: getLastLoginTime
import org.sunbird.services.sso.SSOManager; //导入依赖的package包/类
private String getLastLoginTime(String userId, String time) {
String lastLoginTime = "0";
if (Boolean.parseBoolean(PropertiesCache.getInstance().getProperty(JsonKey.IS_SSO_ENABLED))) {
SSOManager manager = SSOServiceFactory.getInstance();
lastLoginTime = manager.getLastLoginTime(userId);
} else {
lastLoginTime = time;
}
if (ProjectUtil.isStringNullOREmpty(lastLoginTime)) {
return "0";
}
return lastLoginTime;
}