本文整理了Java中fathom.realm.Account.getAuthorizations()
方法的一些代码示例,展示了Account.getAuthorizations()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Account.getAuthorizations()
方法的具体详情如下:
包路径:fathom.realm.Account
类名称:Account
方法名:getAuthorizations
暂无
代码示例来源:origin: com.gitblit.fathom/fathom-security-ldap
/**
* Set the admin attribute from group memberships retrieved from LDAP.
*
* @param account
*/
private void setAdminAttribute(Account account) {
if (adminGroups != null) {
for (String adminGroup : adminGroups) {
if (adminGroup.startsWith("@") && account.getUsername().equalsIgnoreCase(adminGroup.substring(1))) {
// admin user
account.getAuthorizations().addPermission("*");
} else if (account.hasRole(adminGroup)) {
// admin role
account.getAuthorizations().addPermission("*");
}
}
}
}
代码示例来源:origin: gitblit/fathom
/**
* Set the admin attribute from group memberships retrieved from Windows.
*
* @param account
*/
private void setAdminAttribute(Account account) {
if (adminGroups != null) {
for (String adminGroup : adminGroups) {
if (adminGroup.startsWith("@") && account.getUsername().equalsIgnoreCase(adminGroup.substring(1))) {
// admin user
account.getAuthorizations().addPermission("*");
} else if (account.hasRole(adminGroup)) {
// admin role
account.getAuthorizations().addPermission("*");
}
}
}
}
代码示例来源:origin: gitblit/fathom
/**
* Set the admin attribute from group memberships retrieved from LDAP.
*
* @param account
*/
private void setAdminAttribute(Account account) {
if (adminGroups != null) {
for (String adminGroup : adminGroups) {
if (adminGroup.startsWith("@") && account.getUsername().equalsIgnoreCase(adminGroup.substring(1))) {
// admin user
account.getAuthorizations().addPermission("*");
} else if (account.hasRole(adminGroup)) {
// admin role
account.getAuthorizations().addPermission("*");
}
}
}
}
代码示例来源:origin: com.gitblit.fathom/fathom-security-jdbc
private void setAuthorizationsByQuery(Connection conn, Account account) throws SQLException {
// Retrieve roles and permissions from database
Map<String, Role> declaredRoles = getDefinedRoles(conn);
Set<String> roles = getRolesByQuery(conn, account.getUsername());
for (String role : roles) {
if (declaredRoles.containsKey(role)) {
Role declaredRole = declaredRoles.get(role);
account.getAuthorizations().addRole(declaredRole);
} else {
account.getAuthorizations().addRole(role);
}
}
Set<String> permissions = getPermissionsByQuery(conn, account.getUsername());
for (String permission : permissions) {
account.getAuthorizations().addPermission(permission);
}
}
代码示例来源:origin: gitblit/fathom
private void setAuthorizationsByQuery(Connection conn, Account account) throws SQLException {
// Retrieve roles and permissions from database
Map<String, Role> declaredRoles = getDefinedRoles(conn);
Set<String> roles = getRolesByQuery(conn, account.getUsername());
for (String role : roles) {
if (declaredRoles.containsKey(role)) {
Role declaredRole = declaredRoles.get(role);
account.getAuthorizations().addRole(declaredRole);
} else {
account.getAuthorizations().addRole(role);
}
}
Set<String> permissions = getPermissionsByQuery(conn, account.getUsername());
for (String permission : permissions) {
account.getAuthorizations().addPermission(permission);
}
}
代码示例来源:origin: com.gitblit.fathom/fathom-security-jdbc
Set<String> permissions = toSet(value, SEMI_COLON_DELIMITER);
for (String permission : permissions) {
account.getAuthorizations().addPermission(permission);
if (definedRoles.containsKey(role)) {
Role definedRole = definedRoles.get(role);
account.getAuthorizations().addRole(definedRole);
} else {
account.getAuthorizations().addRole(role);
代码示例来源:origin: gitblit/fathom
if (definedRoles.containsKey(role)) {
Role definedRole = definedRoles.get(role);
account.getAuthorizations().addRole(definedRole);
} else {
account.getAuthorizations().addRole(role);
account.getAuthorizations().addPermission(permission);
代码示例来源:origin: gitblit/fathom
Set<String> permissions = toSet(value, SEMI_COLON_DELIMITER);
for (String permission : permissions) {
account.getAuthorizations().addPermission(permission);
if (definedRoles.containsKey(role)) {
Role definedRole = definedRoles.get(role);
account.getAuthorizations().addRole(definedRole);
} else {
account.getAuthorizations().addRole(role);
代码示例来源:origin: com.gitblit.fathom/fathom-security
if (definedRoles.containsKey(role)) {
Role definedRole = definedRoles.get(role);
account.getAuthorizations().addRole(definedRole);
} else {
account.getAuthorizations().addRole(role);
account.getAuthorizations().addPermission(permission);
代码示例来源:origin: gitblit/fathom
if (definedRoles.containsKey(role)) {
Role definedRole = definedRoles.get(role);
account.getAuthorizations().addRole(definedRole);
} else {
account.getAuthorizations().addRole(role);
代码示例来源:origin: com.gitblit.fathom/fathom-security-ldap
private void setAccountRoles(LDAPConnection ldapConnection, SearchResultEntry accountSearchResult, Account account) {
String accountDN = accountSearchResult.getDN();
String groupMemberPattern = this.groupMemberPattern.replace("${dn}", escapeLDAPSearchFilter(accountDN));
groupMemberPattern = groupMemberPattern.replace("${username}", escapeLDAPSearchFilter(account.getUsername()));
// Fill in attributes into groupMemberPattern
for (Attribute attribute : accountSearchResult.getAttributes()) {
groupMemberPattern = groupMemberPattern.replace("${" + attribute.getName() + "}", escapeLDAPSearchFilter(attribute.getValue()));
}
SearchResult groupsSearchResult = doSearch(ldapConnection, groupBase, true, groupMemberPattern, Arrays.asList("cn"));
if (groupsSearchResult != null && groupsSearchResult.getEntryCount() > 0) {
for (int i = 0; i < groupsSearchResult.getEntryCount(); i++) {
SearchResultEntry groupEntry = groupsSearchResult.getSearchEntries().get(i);
String roleName = groupEntry.getAttribute("cn").getValue();
account.getAuthorizations().addRole(roleName);
}
}
}
代码示例来源:origin: gitblit/fathom
private void setAccountRoles(LDAPConnection ldapConnection, SearchResultEntry accountSearchResult, Account account) {
String accountDN = accountSearchResult.getDN();
String groupMemberPattern = this.groupMemberPattern.replace("${dn}", escapeLDAPSearchFilter(accountDN));
groupMemberPattern = groupMemberPattern.replace("${username}", escapeLDAPSearchFilter(account.getUsername()));
// Fill in attributes into groupMemberPattern
for (Attribute attribute : accountSearchResult.getAttributes()) {
groupMemberPattern = groupMemberPattern.replace("${" + attribute.getName() + "}", escapeLDAPSearchFilter(attribute.getValue()));
}
SearchResult groupsSearchResult = doSearch(ldapConnection, groupBase, true, groupMemberPattern, Arrays.asList("cn"));
if (groupsSearchResult != null && groupsSearchResult.getEntryCount() > 0) {
for (int i = 0; i < groupsSearchResult.getEntryCount(); i++) {
SearchResultEntry groupEntry = groupsSearchResult.getSearchEntries().get(i);
String roleName = groupEntry.getAttribute("cn").getValue();
account.getAuthorizations().addRole(roleName);
}
}
}
代码示例来源:origin: gitblit/fathom
account.getAuthorizations().addRole(group.getFqn());
代码示例来源:origin: com.gitblit.fathom/fathom-security
aggregateAccount.getAuthorizations()
.addRoles(account.getAuthorizations().getRoles())
.addPermissions(account.getAuthorizations().getPermissions());
});
代码示例来源:origin: gitblit/fathom
aggregateAccount.getAuthorizations()
.addRoles(account.getAuthorizations().getRoles())
.addPermissions(account.getAuthorizations().getPermissions());
});
代码示例来源:origin: gitblit/fathom
account.getAuthorizations().addRoles(asArray(jedis.lrange(key(username, roleMapping), 0, -1)));
account.getAuthorizations().addPermissions(asArray(jedis.lrange(key(username, permissionMapping), 0, -1)));
内容来源于网络,如有侵权,请联系作者删除!