• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Java User类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Java中org.apache.guacamole.net.auth.User的典型用法代码示例。如果您正苦于以下问题:Java User类的具体用法?Java User怎么用?Java User使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



User类属于org.apache.guacamole.net.auth包,在下文中一共展示了User类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。

示例1: getObjects

import org.apache.guacamole.net.auth.User; //导入依赖的package包/类
/**
 * Returns a map of all objects available within this DirectoryResource,
 * filtering the returned map by the given permission, if specified.
 *
 * @param permissions
 *     The set of permissions to filter with. A user must have one or more
 *     of these permissions for the affected objects to appear in the
 *     result. If null, no filtering will be performed.
 *
 * @return
 *     A map of all visible objects. If a permission was specified, this
 *     map will contain only those objects for which the current user has
 *     that permission.
 *
 * @throws GuacamoleException
 *     If an error is encountered while retrieving the objects.
 */
@GET
public Map<String, ExternalType> getObjects(
        @QueryParam("permission") List<ObjectPermission.Type> permissions)
        throws GuacamoleException {

    // An admin user has access to all objects
    User self = userContext.self();
    SystemPermissionSet systemPermissions = self.getSystemPermissions();
    boolean isAdmin = systemPermissions.hasPermission(SystemPermission.Type.ADMINISTER);

    // Filter objects, if requested
    Collection<String> identifiers = directory.getIdentifiers();
    if (!isAdmin && permissions != null && !permissions.isEmpty()) {
        ObjectPermissionSet objectPermissions = self.getUserPermissions();
        identifiers = objectPermissions.getAccessibleObjects(permissions, identifiers);
    }

    // Translate each retrieved object into the corresponding external object
    Map<String, ExternalType> apiObjects = new HashMap<String, ExternalType>();
    for (InternalType object : directory.getAll(identifiers))
        apiObjects.put(object.getIdentifier(), translator.toExternalObject(object));

    return apiObjects;

}
 
开发者ID:apache,项目名称:guacamole-client,代码行数:43,代码来源:DirectoryResource.java


示例2: getParameters

import org.apache.guacamole.net.auth.User; //导入依赖的package包/类
/**
 * Retrieves the connection parameters associated with the SharingProfile
 * exposed by this SharingProfile resource.
   *
 * @return
 *     A map of parameter name/value pairs.
 *
 * @throws GuacamoleException
 *     If an error occurs while retrieving the connection parameters of the
 *     SharingProfile.
 */
@GET
@Path("parameters")
public Map<String, String> getParameters()
        throws GuacamoleException {

    User self = userContext.self();

    // Retrieve permission sets
    SystemPermissionSet systemPermissions = self.getSystemPermissions();
    ObjectPermissionSet sharingProfilePermissions = self.getSharingProfilePermissions();

    // Deny access if adminstrative or update permission is missing
    String identifier = sharingProfile.getIdentifier();
    if (!systemPermissions.hasPermission(SystemPermission.Type.ADMINISTER)
     && !sharingProfilePermissions.hasPermission(ObjectPermission.Type.UPDATE, identifier))
        throw new GuacamoleSecurityException("Permission to read sharing profile parameters denied.");

    // Return parameter map
    return sharingProfile.getParameters();

}
 
开发者ID:apache,项目名称:guacamole-client,代码行数:33,代码来源:SharingProfileResource.java


示例3: configure

import org.apache.guacamole.net.auth.User; //导入依赖的package包/类
@Override
protected void configure() {

    // Create the required DirectoryResourceFactory implementation
    install(new FactoryModuleBuilder()
            .implement(
                new TypeLiteral<DirectoryResource<User, APIUser>>() {},
                UserDirectoryResource.class
            )
            .build(new TypeLiteral<DirectoryResourceFactory<User, APIUser>>() {}));

    // Create the required DirectoryObjectResourceFactory implementation
    install(new FactoryModuleBuilder()
            .implement(
                new TypeLiteral<DirectoryObjectResource<User, APIUser>>() {},
                UserResource.class
            )
            .build(new TypeLiteral<DirectoryObjectResourceFactory<User, APIUser>>() {}));

    // Bind translator for converting between User and APIUser
    bind(new TypeLiteral<DirectoryObjectTranslator<User, APIUser>>() {})
            .to(UserObjectTranslator.class);

}
 
开发者ID:apache,项目名称:guacamole-client,代码行数:25,代码来源:UserModule.java


示例4: getConnectionParameters

import org.apache.guacamole.net.auth.User; //导入依赖的package包/类
/**
 * Retrieves the parameters associated with a single connection.
 * 
 * @return
 *     A map of parameter name/value pairs.
 *
 * @throws GuacamoleException
 *     If an error occurs while retrieving the connection parameters.
 */
@GET
@Path("parameters")
public Map<String, String> getConnectionParameters()
        throws GuacamoleException {

    User self = userContext.self();

    // Retrieve permission sets
    SystemPermissionSet systemPermissions = self.getSystemPermissions();
    ObjectPermissionSet connectionPermissions = self.getConnectionPermissions();

    // Deny access if adminstrative or update permission is missing
    String identifier = connection.getIdentifier();
    if (!systemPermissions.hasPermission(SystemPermission.Type.ADMINISTER)
     && !connectionPermissions.hasPermission(ObjectPermission.Type.UPDATE, identifier))
        throw new GuacamoleSecurityException("Permission to read connection parameters denied.");

    // Retrieve connection configuration
    GuacamoleConfiguration config = connection.getConfiguration();

    // Return parameter map
    return config.getParameters();

}
 
开发者ID:apache,项目名称:guacamole-client,代码行数:34,代码来源:ConnectionResource.java


示例5: ConnectionGroupTree

import org.apache.guacamole.net.auth.User; //导入依赖的package包/类
/**
 * Creates a new connection group tree using the given connection group as
 * the tree root.
 *
 * @param userContext
 *     The context of the user obtaining the connection group tree.
 *
 * @param root
 *     The connection group to use as the root of this connection group
 *     tree.
 * 
 * @param permissions
 *     If specified and non-empty, limit the contents of the tree to only
 *     those connections for which the current user has any of the given
 *     permissions. Otherwise, all visible connections are returned.
 *     Connection groups are unaffected by this parameter.
 *
 * @throws GuacamoleException
 *     If an error occurs while retrieving the tree of connection groups
 *     and their descendants.
 */
public ConnectionGroupTree(UserContext userContext, ConnectionGroup root,
        List<ObjectPermission.Type> permissions) throws GuacamoleException {

    // Store root of tree
    this.rootAPIGroup = new APIConnectionGroup(root);
    retrievedGroups.put(root.getIdentifier(), this.rootAPIGroup);

    // Store user's current permissions
    User self = userContext.self();
    this.connectionPermissions = self.getConnectionPermissions();
    this.sharingProfilePermissions = self.getSharingProfilePermissions();

    // Store required directories
    this.connectionDirectory = userContext.getConnectionDirectory();
    this.connectionGroupDirectory = userContext.getConnectionGroupDirectory();
    this.sharingProfileDirectory = userContext.getSharingProfileDirectory();

    // Add all descendants
    addConnectionGroupDescendants(Collections.singleton(root), permissions);
    
}
 
开发者ID:apache,项目名称:guacamole-client,代码行数:43,代码来源:ConnectionGroupTree.java


示例6: init

import org.apache.guacamole.net.auth.User; //导入依赖的package包/类
/**
 * Creates a new SharedUserContext which provides access ONLY to the given
 * user, the SharedConnections associated with the share keys used by that
 * user, and an internal root connection group containing only those
 * SharedConnections.
 *
 * @param authProvider
 *     The AuthenticationProvider that created this
 *     SharedUserContext;
 *
 * @param user
 *     The RemoteAuthenticatedUser for whom this SharedUserContext is being
 *     created.
 */
public void init(AuthenticationProvider authProvider, RemoteAuthenticatedUser user) {

    // Associate the originating authentication provider
    this.authProvider = authProvider;

    // Provide access to all connections shared with the given user
    this.connectionDirectory.init(user);

    // The connection group directory contains only the root group
    this.rootGroup = new SharedRootConnectionGroup(this);
    this.connectionGroupDirectory = new SimpleConnectionGroupDirectory(
            Collections.singletonList(this.rootGroup));

    // Create internal pseudo-account representing the authenticated user
    this.self = new SharedUser(user, this);

    // Do not provide access to any user accounts via the directory
    this.userDirectory = new SimpleDirectory<User>();

}
 
开发者ID:apache,项目名称:guacamole-client,代码行数:35,代码来源:SharedUserContext.java


示例7: getModelInstance

import org.apache.guacamole.net.auth.User; //导入依赖的package包/类
@Override
protected UserModel getModelInstance(ModeledAuthenticatedUser currentUser,
        final User object) throws GuacamoleException {

    // Create new ModeledUser backed by blank model
    UserModel model = new UserModel();
    ModeledUser user = getObjectInstance(currentUser, model);

    // Set model contents through ModeledUser, copying the provided user
    user.setIdentifier(object.getIdentifier());
    user.setPassword(object.getPassword());
    user.setAttributes(object.getAttributes());

    return model;
    
}
 
开发者ID:apache,项目名称:guacamole-client,代码行数:17,代码来源:UserService.java


示例8: beforeCreate

import org.apache.guacamole.net.auth.User; //导入依赖的package包/类
@Override
protected void beforeCreate(ModeledAuthenticatedUser user, User object,
        UserModel model) throws GuacamoleException {

    super.beforeCreate(user, object, model);
    
    // Username must not be blank
    if (model.getIdentifier() == null || model.getIdentifier().trim().isEmpty())
        throw new GuacamoleClientException("The username must not be blank.");
    
    // Do not create duplicate users
    Collection<UserModel> existing = userMapper.select(Collections.singleton(model.getIdentifier()));
    if (!existing.isEmpty())
        throw new GuacamoleClientException("User \"" + model.getIdentifier() + "\" already exists.");

    // Verify new password does not violate defined policies (if specified)
    if (object.getPassword() != null)
        passwordPolicyService.verifyPassword(object.getIdentifier(), object.getPassword());

}
 
开发者ID:apache,项目名称:guacamole-client,代码行数:21,代码来源:UserService.java


示例9: getUsers

import org.apache.guacamole.net.auth.User; //导入依赖的package包/类
/**
 * Returns all Guacamole users accessible to the user currently bound under
 * the given LDAP connection.
 *
 * @param ldapConnection
 *     The current connection to the LDAP server, associated with the
 *     current user.
 *
 * @return
 *     All users accessible to the user currently bound under the given
 *     LDAP connection, as a map of connection identifier to corresponding
 *     user object.
 *
 * @throws GuacamoleException
 *     If an error occurs preventing retrieval of users.
 */
public Map<String, User> getUsers(LDAPConnection ldapConnection)
        throws GuacamoleException {

    // Build map of users by querying each username attribute separately
    Map<String, User> users = new HashMap<String, User>();
    for (String usernameAttribute : confService.getUsernameAttributes()) {

        // Attempt to pull all users with given attribute
        try {
            putAllUsers(users, ldapConnection, usernameAttribute);
        }

        // Log any errors non-fatally
        catch (GuacamoleException e) {
            logger.warn("Could not query list of all users for attribute \"{}\": {}",
                    usernameAttribute, e.getMessage());
            logger.debug("Error querying list of all users.", e);
        }

    }

    // Return map of all users
    return users;

}
 
开发者ID:apache,项目名称:guacamole-client,代码行数:42,代码来源:UserService.java


示例10: getUser

import org.apache.guacamole.net.auth.User; //导入依赖的package包/类
/**
 * Returns the user object of the user to whom the given UserData object
 * belongs.
 *
 * @param userData
 *     All data associated with the user whose own user object is being
 *     retrieved.
 *
 * @return
 *     The user object of the user to whom the given UserData object
 *     belongs.
 */
public User getUser(UserData userData) {

    // Pull username from user data
    String username = userData.getUsername();

    // Build user object with READ access to all available data
    return new SimpleUser(
        username,
        getUserIdentifiers(userData),
        getConnectionIdentifiers(userData),
        getConnectionGroupIdentifiers(userData)
    );

}
 
开发者ID:glyptodon,项目名称:guacamole-auth-callback,代码行数:27,代码来源:UserDataService.java


示例11: APIPermissionSet

import org.apache.guacamole.net.auth.User; //导入依赖的package包/类
/**
 * Creates a new permission set containing all permissions currently
 * granted to the given user.
 *
 * @param user
 *     The user whose permissions should be stored within this permission
 *     set.
 *
 * @throws GuacamoleException
 *     If an error occurs while retrieving the user's permissions.
 */
public APIPermissionSet(User user) throws GuacamoleException {

    // Add all permissions from the provided user
    addSystemPermissions(systemPermissions,           user.getSystemPermissions());
    addObjectPermissions(connectionPermissions,       user.getConnectionPermissions());
    addObjectPermissions(connectionGroupPermissions,  user.getConnectionGroupPermissions());
    addObjectPermissions(sharingProfilePermissions,   user.getSharingProfilePermissions());
    addObjectPermissions(activeConnectionPermissions, user.getActiveConnectionPermissions());
    addObjectPermissions(userPermissions,             user.getUserPermissions());
    
}
 
开发者ID:apache,项目名称:guacamole-client,代码行数:23,代码来源:APIPermissionSet.java


示例12: applyExternalChanges

import org.apache.guacamole.net.auth.User; //导入依赖的package包/类
@Override
public void applyExternalChanges(User existingObject,
        APIUser object) throws GuacamoleException {

    // Do not update the user password if no password was provided
    if (object.getPassword() != null)
        existingObject.setPassword(object.getPassword());

    // Update user attributes
    existingObject.setAttributes(object.getAttributes());

}
 
开发者ID:apache,项目名称:guacamole-client,代码行数:13,代码来源:UserObjectTranslator.java


示例13: APIUser

import org.apache.guacamole.net.auth.User; //导入依赖的package包/类
/**
 * Construct a new APIUser from the provided User.
 * @param user The User to construct the APIUser from.
 */
public APIUser(User user) {

    // Set user information
    this.username = user.getIdentifier();
    this.password = user.getPassword();
    this.lastActive = user.getLastActive();

    // Associate any attributes
    this.attributes = user.getAttributes();

}
 
开发者ID:apache,项目名称:guacamole-client,代码行数:16,代码来源:APIUser.java


示例14: init

import org.apache.guacamole.net.auth.User; //导入依赖的package包/类
/**
 * Initializes this UserContext using the provided AuthenticatedUser and
 * LDAPConnection.
 *
 * @param user
 *     The AuthenticatedUser representing the user that authenticated. This
 *     user may have been authenticated by a different authentication
 *     provider (not LDAP).
 *
 * @param ldapConnection
 *     The connection to the LDAP server to use when querying accessible
 *     Guacamole users and connections.
 *
 * @throws GuacamoleException
 *     If associated data stored within the LDAP directory cannot be
 *     queried due to an error.
 */
public void init(AuthenticatedUser user, LDAPConnection ldapConnection)
        throws GuacamoleException {

    // Query all accessible users
    userDirectory = new SimpleDirectory<User>(
        userService.getUsers(ldapConnection)
    );

    // Query all accessible connections
    connectionDirectory = new SimpleDirectory<Connection>(
        connectionService.getConnections(user, ldapConnection)
    );

    // Root group contains only connections
    rootGroup = new SimpleConnectionGroup(
        LDAPAuthenticationProvider.ROOT_CONNECTION_GROUP,
        LDAPAuthenticationProvider.ROOT_CONNECTION_GROUP,
        connectionDirectory.getIdentifiers(),
        Collections.<String>emptyList()
    );

    // Expose only the root group in the connection group directory
    connectionGroupDirectory = new SimpleConnectionGroupDirectory(Collections.singleton(rootGroup));

    // Init self with basic permissions
    self = new SimpleUser(
        user.getIdentifier(),
        userDirectory.getIdentifiers(),
        connectionDirectory.getIdentifiers(),
        connectionGroupDirectory.getIdentifiers()
    );

}
 
开发者ID:apache,项目名称:guacamole-client,代码行数:51,代码来源:UserContext.java


示例15: self

import org.apache.guacamole.net.auth.User; //导入依赖的package包/类
@Override
public User self() {
    return userDataService.getUser(userData);
}
 
开发者ID:glyptodon,项目名称:guacamole-auth-callback,代码行数:5,代码来源:UserContext.java


示例16: getUserDirectory

import org.apache.guacamole.net.auth.User; //导入依赖的package包/类
@Override
public Directory<User> getUserDirectory() throws GuacamoleException {
    return userDataService.getUserDirectory(userData);
}
 
开发者ID:glyptodon,项目名称:guacamole-auth-callback,代码行数:5,代码来源:UserContext.java


示例17: self

import org.apache.guacamole.net.auth.User; //导入依赖的package包/类
@Override
public User self() {
    return self;
}
 
开发者ID:apache,项目名称:guacamole-client,代码行数:5,代码来源:SimpleUserContext.java


示例18: getUserDirectory

import org.apache.guacamole.net.auth.User; //导入依赖的package包/类
@Override
public Directory<User> getUserDirectory()
        throws GuacamoleException {
    return userDirectory;
}
 
开发者ID:apache,项目名称:guacamole-client,代码行数:6,代码来源:SimpleUserContext.java


示例19: toExternalObject

import org.apache.guacamole.net.auth.User; //导入依赖的package包/类
@Override
public APIUser toExternalObject(User object)
        throws GuacamoleException {
    return new APIUser(object);
}
 
开发者ID:apache,项目名称:guacamole-client,代码行数:6,代码来源:UserObjectTranslator.java


示例20: toInternalObject

import org.apache.guacamole.net.auth.User; //导入依赖的package包/类
@Override
public User toInternalObject(APIUser object)
        throws GuacamoleException {
    return new APIUserWrapper(object);
}
 
开发者ID:apache,项目名称:guacamole-client,代码行数:6,代码来源:UserObjectTranslator.java



注:本文中的org.apache.guacamole.net.auth.User类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java AccountServiceLocal类代码示例发布时间:2022-05-15
下一篇:
Java Format类代码示例发布时间:2022-05-15
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap