本文整理汇总了Java中javax.security.enterprise.CallerPrincipal类的典型用法代码示例。如果您正苦于以下问题:Java CallerPrincipal类的具体用法?Java CallerPrincipal怎么用?Java CallerPrincipal使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
CallerPrincipal类属于javax.security.enterprise包,在下文中一共展示了CallerPrincipal类的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: generateLoginToken
import javax.security.enterprise.CallerPrincipal; //导入依赖的package包/类
@Override
public String generateLoginToken(CallerPrincipal callerPrincipal, Set<String> groups) {
if (callerPrincipal instanceof OAuth2User) {
OAuth2User user = (OAuth2User) callerPrincipal;
tokenCache.put(user.getId(), new SecurityData(callerPrincipal, groups));
return user.getId();
}
return null;
}
示例2: validate
import javax.security.enterprise.CallerPrincipal; //导入依赖的package包/类
@Override
public CredentialValidationResult validate(RememberMeCredential credential) {
return users.findByLoginToken(credential.getToken(), REMEMBER_ME)
.map(u -> new CredentialValidationResult(new CallerPrincipal(u.getUsername()), u.getRoles()))
.orElse(INVALID_RESULT);
}
示例3: generateLoginToken
import javax.security.enterprise.CallerPrincipal; //导入依赖的package包/类
@Override
public String generateLoginToken(CallerPrincipal callerPrincipal, Set<String> groups) {
return userService.generate(callerPrincipal.getName(), request.getRemoteAddr(), getDescription(), REMEMBER_ME);
}
示例4: SecurityData
import javax.security.enterprise.CallerPrincipal; //导入依赖的package包/类
public SecurityData(CallerPrincipal callerPrincipal, Set<String> groups) {
this.callerPrincipal = callerPrincipal;
this.groups = groups;
}
示例5: getCallerPrincipal
import javax.security.enterprise.CallerPrincipal; //导入依赖的package包/类
public CallerPrincipal getCallerPrincipal() {
return callerPrincipal;
}
示例6: generateLoginToken
import javax.security.enterprise.CallerPrincipal; //导入依赖的package包/类
@Override
public String generateLoginToken(CallerPrincipal callerPrincipal, Set<String> groups) {
return tokenProvider.createToken(callerPrincipal.getName(), groups, true);
}