use of org.maxkey.entity.apps.AppsFormBasedDetails in project MaxKey by dromara.
the class FormBasedDetailsController method forwardUpdate.
@RequestMapping(value = { "/forwardUpdate/{id}" })
public ModelAndView forwardUpdate(@PathVariable("id") String id) {
ModelAndView modelAndView = new ModelAndView("apps/formbased/appUpdate");
AppsFormBasedDetails formBasedDetails = formBasedDetailsService.getAppDetails(id, false);
decoderSecret(formBasedDetails);
decoderSharedPassword(formBasedDetails);
formBasedDetails.transIconBase64();
modelAndView.addObject("model", formBasedDetails);
return modelAndView;
}
use of org.maxkey.entity.apps.AppsFormBasedDetails in project MaxKey by dromara.
the class FormBasedAuthorizeEndpoint method authorize.
@Operation(summary = "FormBased认证地址接口", description = "参数应用ID", method = "GET")
@RequestMapping("/authz/formbased/{id}")
public ModelAndView authorize(HttpServletRequest request, @PathVariable("id") String id) {
AppsFormBasedDetails formBasedDetails = formBasedDetailsService.getAppDetails(id, true);
_logger.debug("formBasedDetails {}", formBasedDetails);
Apps application = getApp(id);
formBasedDetails.setAdapter(application.getAdapter());
formBasedDetails.setIsAdapter(application.getIsAdapter());
ModelAndView modelAndView = null;
Accounts account = getAccounts(formBasedDetails);
_logger.debug("Accounts {}", account);
if (account == null) {
return generateInitCredentialModelAndView(id, "/authz/formbased/" + id);
} else {
modelAndView = new ModelAndView();
AbstractAuthorizeAdapter adapter;
if (ConstsBoolean.isTrue(formBasedDetails.getIsAdapter())) {
Object formBasedAdapter = Instance.newInstance(formBasedDetails.getAdapter());
adapter = (AbstractAuthorizeAdapter) formBasedAdapter;
} else {
FormBasedDefaultAdapter formBasedDefaultAdapter = new FormBasedDefaultAdapter();
adapter = (AbstractAuthorizeAdapter) formBasedDefaultAdapter;
}
adapter.setAuthentication((SigninPrincipal) WebContext.getAuthentication().getPrincipal());
adapter.setUserInfo(WebContext.getUserInfo());
adapter.setApp(formBasedDetails);
adapter.setAccount(account);
modelAndView = adapter.authorize(modelAndView);
}
_logger.debug("FormBased View Name {}", modelAndView.getViewName());
return modelAndView;
}
use of org.maxkey.entity.apps.AppsFormBasedDetails in project MaxKey by dromara.
the class FormBasedNetease163EmailAdapter method authorize.
@Override
public ModelAndView authorize(ModelAndView modelAndView) {
modelAndView.setViewName("authorize/formbased_163email_sso_submint");
AppsFormBasedDetails details = (AppsFormBasedDetails) app;
modelAndView.addObject("username", account.getRelatedUsername().substring(account.getRelatedUsername().indexOf("@")));
modelAndView.addObject("email", account.getRelatedUsername());
modelAndView.addObject("password", account.getRelatedPassword());
if (ConstsBoolean.isTrue(details.getIsExtendAttr())) {
modelAndView.addObject("extendAttr", details.getExtendAttr());
modelAndView.addObject("isExtendAttr", true);
} else {
modelAndView.addObject("isExtendAttr", false);
}
modelAndView.addObject("action", details.getRedirectUri());
modelAndView.addObject("usernameMapping", details.getUsernameMapping());
modelAndView.addObject("passwordMapping", details.getPasswordMapping());
return modelAndView;
}
use of org.maxkey.entity.apps.AppsFormBasedDetails in project MaxKey by dromara.
the class FormBasedDetailsServiceTest method insert.
@Test
public void insert() throws Exception {
_logger.info("insert...");
AppsFormBasedDetails formBasedDetails = new AppsFormBasedDetails();
service.insert(formBasedDetails);
Thread.sleep(1000);
service.remove(formBasedDetails.getId());
}
use of org.maxkey.entity.apps.AppsFormBasedDetails in project MaxKey by dromara.
the class FormBasedDetailsServiceTest method queryPageResults.
@Test
public void queryPageResults() throws Exception {
_logger.info("queryPageResults...");
AppsFormBasedDetails formBasedDetails = new AppsFormBasedDetails();
formBasedDetails.setPageNumber(2);
_logger.info("queryPageResults " + service.queryPageResults(formBasedDetails));
}
Aggregations