本文整理汇总了Java中enkan.collection.Parameters.get方法的典型用法代码示例。如果您正苦于以下问题:Java Parameters.get方法的具体用法?Java Parameters.get怎么用?Java Parameters.get使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类enkan.collection.Parameters
的用法示例。
在下文中一共展示了Parameters.get方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: search
import enkan.collection.Parameters; //导入方法依赖的package包/类
@RolesAllowed({"LIST_USERS", "LIST_ANY_USERS"})
public List<User> search(Parameters params, UserPrincipal principal) {
String word = params.get("q");
UserDao userDao = daoProvider.getDao(UserDao.class);
SelectOptions options = SelectOptions.get();
return userDao.selectForIncrementalSearch(word, principal, options);
}
示例2: newForm
import enkan.collection.Parameters; //导入方法依赖的package包/类
public HttpResponse newForm(Parameters params) {
String code = params.get("code");
List<GroupInvitation> groupInvitations = Collections.emptyList();
OidcInvitation oidcInvitation = null;
SignUpForm form = new SignUpForm();
form.setCode(code);
if (code != null) {
InvitationDao invitationDao = daoProvider.getDao(InvitationDao.class);
Invitation invitation = invitationDao.selectByCode(code);
groupInvitations = invitationDao.selectGroupInvitations(invitation.getId());
oidcInvitation = invitationDao.selectOidcInvitation(invitation.getId());
JwtClaim claim = jsonWebToken.decodePayload(oidcInvitation.getOidcPayload(), new TypeReference<JwtClaim>() {});
form.setName(claim.getName());
form.setEmail(claim.getEmail());
}
return templateEngine.render("my/signUp/new",
"signUp", form,
"passwordEnabled", config.isPasswordEnabled(),
"groupInvitations", groupInvitations,
"oidcInvitation", oidcInvitation);
}
示例3: authorize
import enkan.collection.Parameters; //导入方法依赖的package包/类
/**
* Authorization endpoint.
*
* @param params Request parameters
* @param principal User principal
* @param request HttpRequest object
* @return Authorization response
*/
public HttpResponse authorize(Parameters params, UserPermissionPrincipal principal, HttpRequest request) {
if (principal != null) {
Parameters responseParams = Parameters.of();
if (params.containsKey("state")) {
responseParams.put("state", params.get("state"));
}
String clientId = params.get("client_id");
OidcApplicationDao oidcApplicationDao = daoProvider.getDao(OidcApplicationDao.class);
OidcApplication oidcApplication = oidcApplicationDao.selectByClientId(clientId);
String redirectUrl = (String) params.getOrDefault("redirect_url", oidcApplication.getCallbackUrl());
Set<ResponseType> responseTypes = Arrays.stream(((String) params.getOrDefault("response_type", "code")).split("[ ,]+"))
.map(rt -> ResponseType.of(rt))
.filter(Objects::nonNull)
.collect(Collectors.toSet());
if (responseTypes.contains(ID_TOKEN)) {
String nonce = params.get("nonce");
responseParams.put("id_token", createIdToken(principal.getId(), oidcApplication, nonce));
}
if (responseTypes.contains(TOKEN)) {
responseParams.put("access_token", createAccessToken(principal.getName(), clientId, Collections.emptyList()));
responseParams.put("token_type", "bearer");
responseParams.put("expires_in", 3600);
}
if (responseTypes.contains(CODE)) {
KeyValueStore authorizationCodeStore = storeProvider.getStore(AUTHORIZATION_CODE);
String code = RandomUtils.generateRandomString(16, config.getSecureRandom());
authorizationCodeStore.write(code, principal.getId());
responseParams.put("code", code);
}
return HttpResponseUtils.redirect(makeCallbackUrl(redirectUrl, responseParams, responseTypes), FOUND);
} else {
return HttpResponseUtils.redirect("/my/signIn?url=" + request.getUri() + "?" + CodecUtils.urlEncode(request.getQueryString()), SEE_OTHER);
}
}
示例4: login
import enkan.collection.Parameters; //导入方法依赖的package包/类
public HttpResponse login(Parameters params, Conversation conversation) {
if (!conversation.isTransient()) conversation.end();
CustomerDao dao = daoProvider.getDao(CustomerDao.class);
String email = params.get("email");
Customer customer = dao.loginByPassword(email, params.get("password"));
if (customer == null) {
return templateEngine.render("guestbook/login");
} else {
Session session = new Session();
session.put("principal", new LoginPrincipal(email));
return builder(redirect(GuestbookController.class, "list", HttpResponseUtils.RedirectStatusCode.SEE_OTHER))
.set(HttpResponse::setSession, session)
.build();
}
}
示例5: upload
import enkan.collection.Parameters; //导入方法依赖的package包/类
public String upload(Parameters params) {
File tempfile = (File) params.getIn("datafile", "tempfile");
return tempfile.getAbsolutePath() + "("
+ tempfile.length()
+ " bytes) is uploaded. description: "
+ params.get("description");
}
示例6: signInByOidcImplicit
import enkan.collection.Parameters; //导入方法依赖的package包/类
public HttpResponse signInByOidcImplicit(HttpRequest request, Parameters params) {
String idToken = params.get("id_token");
OidcProviderDao oidcProviderDao = daoProvider.getDao(OidcProviderDao.class);
OidcProvider oidcProvider = oidcProviderDao.selectById(params.getLong("id"));
return connectOpenIdToBoucrUser(idToken, oidcProvider, request);
}
示例7: method2
import enkan.collection.Parameters; //导入方法依赖的package包/类
public String method2(Parameters params) {
return "method2です " + params.get("name");
}