Examples of roles()


Examples of com.dodo.blog.ui.authorization.Authorized.roles()

        if ( authorizedRoles != null )
        {
            Account account = WebApplication.get().getLoggedInAccount();
            if ( account != null )
            {
                for ( Role role : authorizedRoles.roles() )
                {
                    if ( account.getRole() == role )
                    {
                        isAuthorized = true;
                        break;
View Full Code Here

Examples of org.jboss.errai.security.shared.api.annotation.RestrictedAccess.roles()

    final User user = authenticationService.getUser();
    final RestrictedAccess annotation = getRestrictedAccessAnnotation(context.getTarget().getClass(), context.getMethod());
    if (user == null) {
      throw new UnauthenticatedException();
    }
    else if (!hasAllRoles(user.getRoles(), annotation.roles())) {
      throw new UnauthorizedException();
    } else {
      return context.proceed();
    }
  }
View Full Code Here

Examples of org.jboss.errai.security.shared.api.annotation.RestrictedAccess.roles()

    final RestrictedAccess annotation = getRestrictedAccessAnnotation(context.getTarget().getClass(),
            context.getMethod());
    if (User.ANONYMOUS.equals(user)) {
      throw new UnauthenticatedException();
    }
    else if (!user.hasAllRoles(annotation.roles())) {
      throw new UnauthorizedException();
    }
    else {
      return context.proceed();
    }
View Full Code Here

Examples of org.jboss.errai.security.shared.api.annotation.RestrictedAccess.roles()

              Stmt.declareFinalVariable(
                      roleListenerVar,
                      MetaClassFactory.parameterizedAs(LifecycleListener.class,
                              MetaClassFactory.typeParametersOf(ctx.getInjector().getInjectedType())),
                              Stmt.newObject(PageRoleLifecycleListener.class,
                                                      (Object) annotation.roles())));
      ctx.getTargetInjector().addStatementToEndOfInjector(
              Stmt.loadVariable("context")
                      .invoke("addInitializationCallback",
                              Refs.get(ctx.getInjector().getInstanceVarName()),
                              createInitializationCallback(
View Full Code Here

Examples of org.jboss.errai.security.shared.api.annotation.RestrictedAccess.roles()

              Stmt.declareFinalVariable(
                      roleListenerVar,
                      MetaClassFactory.parameterizedAs(LifecycleListener.class,
                              MetaClassFactory.typeParametersOf(ctx.getInjector().getInjectedType())),
                              Stmt.newObject(PageRoleLifecycleListener.class,
                                                      (Object[]) annotation.roles())));
      ctx.getTargetInjector().addStatementToEndOfInjector(
              Stmt.loadVariable("context")
                      .invoke("addInitializationCallback",
                              Refs.get(ctx.getInjector().getInstanceVarName()),
                              createInitializationCallback(
View Full Code Here

Examples of org.jboss.resteasy.keystone.client.SkeletonKeyAdminClient.roles()

      Map creds = new HashMap();
      creds.put("password", "foobar");
      newUser.setCredentials(creds);
      Response response = admin.users().create(newUser);
      User user = response.readEntity(User.class);
      response = admin.roles().create("user");
      Role role = response.readEntity(Role.class);
      Projects projects = admin.projects().query("Skeleton Key");
      Project project = projects.getList().get(0);
      admin.projects().addUserRole(project.getId(), user.getId(), role.getId());
View Full Code Here

Examples of org.jboss.resteasy.keystone.client.SkeletonKeyAdminClient.roles()

      Projects projects = admin.projects().query("Skeleton Key");
      Project project = projects.getList().get(0);
      admin.projects().addUserRole(project.getId(), user.getId(), role.getId());

      admin = new SkeletonKeyClientBuilder().username("jsmith").password("foobar").idp(target).admin();
      response = admin.roles().create("error");
      Assert.assertEquals(403, response.getStatus());
      client.close();
   }

   @Test
View Full Code Here

Examples of org.jboss.resteasy.keystone.client.SkeletonKeyAdminClient.roles()

      Map creds = new HashMap();
      creds.put("password", "foobar");
      newUser.setCredentials(creds);
      Response response = admin.users().create(newUser);
      User user = response.readEntity(User.class);
      response = admin.roles().create("user");
      Role role = response.readEntity(Role.class);
      Projects projects = admin.projects().query("Skeleton Key");
      Project project = projects.getList().get(0);
      admin.projects().addUserRole(project.getId(), user.getId(), role.getId());
View Full Code Here

Examples of org.jboss.resteasy.keystone.client.SkeletonKeyAdminClient.roles()

      Map creds = new HashMap();
      creds.put("password", "foobar");
      newUser.setCredentials(creds);
      Response response = admin.users().create(newUser);
      User user = response.readEntity(User.class);
      response = admin.roles().create("user");
      Role role = response.readEntity(Role.class);
      Projects projects = admin.projects().query("Skeleton Key");
      Project project = projects.getList().get(0);
      admin.projects().addUserRole(project.getId(), user.getId(), role.getId());
View Full Code Here

Examples of org.jboss.resteasy.keystone.client.SkeletonKeyAdminClient.roles()

      Projects projects = admin.projects().query("Skeleton Key");
      Project project = projects.getList().get(0);
      admin.projects().addUserRole(project.getId(), user.getId(), role.getId());

      admin = new SkeletonKeyClientBuilder().username("jsmith").password("foobar").idp(target).admin();
      response = admin.roles().create("error");
      Assert.assertEquals(403, response.getStatus());
      client.close();
      stopDeployment();
   }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.