Start line:  
End line:  

Snippet Preview

Snippet HTML Code

Stack Overflow Questions
JBoss, Home of Professional Open Source Copyright Red Hat, Inc., and individual contributors by the

tag. See the copyright.txt in the distribution for a full listing of individual contributors. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
 import  javax.enterprise.context.ApplicationScoped;
 import  javax.inject.Inject;
 import java.util.List;

IdentityManagement allows to assign a set of roles to on Identity Manager provider
 public class IdentityManagementImpl implements IdentityManagement {
     private IdentityManager identityManager;
     private Identity identity;

This method allows to specify which roles must be assigned to

roles The list of roles.
GrantMethods is a builder which a allows to apply a list of roles to the specified
     public GrantMethods grant(String... roles) {
         return .roles(roles);
     public AeroGearUser get(String idthrows RuntimeException {
         User user = .getUser(id);
         if (user == null) {
             throw new RuntimeException("User do not exist");
         return Converter.convertToAerogearUser(.getUser(id));
     public void remove(AeroGearUser aeroGearUser) {
         if (isLoggedIn(aeroGearUser)) {
             throw new RuntimeException("User is logged in");
     public List<AeroGearUserfindAllByRole(String roleName) {
         Role role = .getRole(roleName);
         List aerogearUsers = new ArrayList();
         IdentityQuery<Userquery = .createIdentityQuery(User.class);
         List<Userresult = query.getResultList();
         for (User user : result) {
         return aerogearUsers;

This method creates a new AeroGearUser

    public void create(AeroGearUser aeroGearUser) {
        User picketLinkUser = new SimpleUser(aeroGearUser.getUsername());
         * Disclaimer: PlainTextPassword will encode passwords in SHA-512 with SecureRandom-1024 salt
         * See for more information
        .updateCredential(picketLinkUsernew Password(aeroGearUser.getPassword()));
    private boolean isLoggedIn(AeroGearUser aeroGearUser) {
        return .isLoggedIn() && .getUser().getLoginName().equals(aeroGearUser.getUsername());
New to GrepCode? Check out our FAQ X