use of org.maxkey.entity.apps.Apps in project MaxKey by dromara.
the class OAuth20DetailsController method forwardUpdate.
@RequestMapping(value = { "/forwardUpdate/{id}" })
public ModelAndView forwardUpdate(@PathVariable("id") String id) {
ModelAndView modelAndView = new ModelAndView("apps/oauth20/appUpdate");
BaseClientDetails baseClientDetails = (BaseClientDetails) oauth20JdbcClientDetailsService.loadClientByClientId(id, false);
//
Apps application = appsService.get(id);
decoderSecret(application);
AppsOAuth20Details oauth20Details = new AppsOAuth20Details(application, baseClientDetails);
oauth20Details.setSecret(application.getSecret());
oauth20Details.setClientSecret(application.getSecret());
_logger.debug("forwardUpdate " + oauth20Details);
oauth20Details.transIconBase64();
modelAndView.addObject("model", oauth20Details);
return modelAndView;
}
use of org.maxkey.entity.apps.Apps in project MaxKey by dromara.
the class GroupPrivilegesController method queryAppsInGroup.
@RequestMapping(value = { "/queryAppsInGroup" })
@ResponseBody
public JpaPageResults<GroupPrivileges> queryAppsInGroup(@ModelAttribute("groupApp") GroupPrivileges groupApp) {
JpaPageResults<GroupPrivileges> groupPrivileges;
groupApp.setInstId(WebContext.getUserInfo().getInstId());
groupPrivileges = groupPrivilegesService.queryPageResults("appsInGroup", groupApp);
if (groupPrivileges != null && groupPrivileges.getRows() != null) {
for (Apps app : groupPrivileges.getRows()) {
app.transIconBase64();
}
}
return groupPrivileges;
}
use of org.maxkey.entity.apps.Apps in project MaxKey by dromara.
the class GroupPrivilegesController method queryAppsNotInGroup.
@RequestMapping(value = { "/queryAppsNotInGroup" })
@ResponseBody
public JpaPageResults<GroupPrivileges> queryAppsNotInGroup(@ModelAttribute("groupApp") GroupPrivileges groupApp) {
JpaPageResults<GroupPrivileges> groupPrivileges;
groupApp.setInstId(WebContext.getUserInfo().getInstId());
groupPrivileges = groupPrivilegesService.queryPageResults("appsNotInGroup", groupApp);
if (groupPrivileges != null && groupPrivileges.getRows() != null) {
for (Apps app : groupPrivileges.getRows()) {
app.transIconBase64();
}
}
return groupPrivileges;
}
use of org.maxkey.entity.apps.Apps in project MaxKey by dromara.
the class HistoryLoginAppAdapter method postHandle.
/**
* postHandle .
* @see org.springframework.web.servlet.handler.HandlerInterceptorAdapter#preHandle(
* javax.servlet.http.HttpServletRequest,
* javax.servlet.http.HttpServletResponse, java.lang.Object)
*/
public void postHandle(HttpServletRequest request, HttpServletResponse response, Object handler, ModelAndView modelAndView) throws Exception {
_logger.debug("postHandle");
final Apps app = (Apps) WebContext.getAttribute(WebConstants.AUTHORIZE_SIGN_ON_APP);
String sessionId = (String) WebContext.getAttribute(WebConstants.CURRENT_USER_SESSION_ID);
final UserInfo userInfo = WebContext.getUserInfo();
_logger.debug("sessionId : " + sessionId + " ,appId : " + app.getId());
HistoryLoginApps historyLoginApps = new HistoryLoginApps();
historyLoginApps.setAppId(app.getId());
historyLoginApps.setSessionId(sessionId);
historyLoginApps.setAppName(app.getName());
historyLoginApps.setUserId(userInfo.getId());
historyLoginApps.setUsername(userInfo.getUsername());
historyLoginApps.setDisplayName(userInfo.getDisplayName());
historyLoginApps.setInstId(userInfo.getInstId());
historyLoginAppsService.insert(historyLoginApps);
WebContext.removeAttribute(WebConstants.CURRENT_SINGLESIGNON_URI);
WebContext.removeAttribute(WebConstants.SINGLE_SIGN_ON_APP_ID);
}
use of org.maxkey.entity.apps.Apps in project MaxKey by dromara.
the class ExtendApiZentaoAdapter method authorize.
@Override
public ModelAndView authorize(ModelAndView modelAndView) {
Apps details = (Apps) app;
// extraAttrs from Applications
ExtraAttrs extraAttrs = null;
if (details.getIsExtendAttr() == 1) {
extraAttrs = new ExtraAttrs(details.getExtendAttr());
}
_logger.trace("Extra Attrs " + extraAttrs);
String code = details.getPrincipal();
String key = details.getCredentials();
String time = "" + Instant.now().getEpochSecond();
String token = DigestUtils.md5Hex(code + key + time);
_logger.debug("" + token);
String account = userInfo.getUsername();
String redirect_uri = details.getLoginUrl();
if (redirect_uri.indexOf("api.php?") < 0) {
if (redirect_uri.endsWith("/")) {
redirect_uri += String.format(login_url_template, account, code, time, token);
} else {
redirect_uri += "/" + String.format(login_url_template, account, code, time, token);
}
} else if (redirect_uri.endsWith("&")) {
redirect_uri += String.format(login_url_m_template, account, code, time, token);
} else {
redirect_uri += "&" + String.format(login_url_m_template, account, code, time, token);
}
_logger.debug("redirect_uri : " + redirect_uri);
modelAndView = new ModelAndView("authorize/redirect_sso_submit");
modelAndView.addObject("redirect_uri", redirect_uri);
return modelAndView;
}
Aggregations