Search in sources :

Example 31 with PermitAll

use of javax.annotation.security.PermitAll in project wildfly by wildfly.

the class UncheckedStatelessBean method unchecked.

@PermitAll
public Set<Principal> unchecked() {
    org.wildfly.security.auth.server.SecurityDomain securityDomain = org.wildfly.security.auth.server.SecurityDomain.getCurrent();
    if (securityDomain != null) {
        // elytron profile is enabled
        final Roles roles = ((SessionContextImpl) ctx).getComponent().getIncomingRunAsIdentity().getRoles("ejb");
        final HashSet<Principal> rolesSet = new HashSet<>();
        if (roles != null) {
            roles.forEach(role -> rolesSet.add(new NamePrincipal(role.toString())));
        }
        return rolesSet;
    } else {
        // use legacy approach
        RunAsIdentity rs = (RunAsIdentity) ctx.getCallerPrincipal();
        return rs.getRunAsRoles();
    }
}
Also used : SessionContextImpl(org.jboss.as.ejb3.context.SessionContextImpl) NamePrincipal(org.wildfly.security.auth.principal.NamePrincipal) RunAsIdentity(org.jboss.security.RunAsIdentity) Roles(org.wildfly.security.authz.Roles) NamePrincipal(org.wildfly.security.auth.principal.NamePrincipal) Principal(java.security.Principal) HashSet(java.util.HashSet) PermitAll(javax.annotation.security.PermitAll)

Example 32 with PermitAll

use of javax.annotation.security.PermitAll in project ART-TIME by Artezio.

the class WorkTimeService method getRequiredWorkHours.

@PermitAll
@AbacContext(VIEW_TIMESHEET)
public BigDecimal getRequiredWorkHours(Employee employee, Period period) {
    List<Date> workDayDates = getWorkDayDates(employee, period);
    BigDecimal workDaysNumber = new BigDecimal(workDayDates.size());
    return workDaysNumber.multiply(employee.getWorkLoadHours());
}
Also used : BigDecimal(java.math.BigDecimal) PermitAll(javax.annotation.security.PermitAll) AbacContext(com.artezio.javax.jpa.abac.AbacContext)

Example 33 with PermitAll

use of javax.annotation.security.PermitAll in project jeeshop by remibantos.

the class Catalogs method findPresentationByLocale.

@Path("/{catalogId}/presentations/{locale}")
@PermitAll
public PresentationResource findPresentationByLocale(@PathParam("catalogId") @NotNull Long catalogId, @NotNull @PathParam("locale") String locale) {
    Catalog catalog = entityManager.find(Catalog.class, catalogId);
    checkNotNull(catalog);
    Presentation presentation = catalog.getPresentationByLocale().get(locale);
    return presentationResource.init(catalog, locale, presentation);
}
Also used : Presentation(org.rembx.jeeshop.catalog.model.Presentation) Catalog(org.rembx.jeeshop.catalog.model.Catalog) PermitAll(javax.annotation.security.PermitAll)

Example 34 with PermitAll

use of javax.annotation.security.PermitAll in project jeeshop by remibantos.

the class Stores method findPresentationByLocale.

@Path("/{storeId}/presentations/{locale}")
@PermitAll
public PresentationResource findPresentationByLocale(@PathParam("storedId") @NotNull Long storeId, @NotNull @PathParam("locale") String locale) {
    Store store = entityManager.find(Store.class, storeId);
    checkNotNull(store);
    Presentation presentation = store.getPresentationByLocale().get(locale);
    return presentationResource.init(store, locale, presentation);
}
Also used : Store(org.rembx.jeeshop.catalog.model.Store) Presentation(org.rembx.jeeshop.catalog.model.Presentation) PermitAll(javax.annotation.security.PermitAll)

Example 35 with PermitAll

use of javax.annotation.security.PermitAll in project jeeshop by remibantos.

the class Stores method findCatalogs.

@GET
@Path("/{storeId}/catalogs")
@Produces(MediaType.APPLICATION_JSON)
@PermitAll
public List<Catalog> findCatalogs(@Context SecurityContext securityContext, @PathParam("storeId") @NotNull Long storeId, @QueryParam("locale") String locale) {
    Store loadedStore = entityManager.find(Store.class, storeId);
    checkNotNull(loadedStore);
    List<Catalog> catalogs = loadedStore.getCatalogs();
    if (catalogs.isEmpty()) {
        return new ArrayList<>();
    }
    if (isAdminUser(securityContext) || isOwner(securityContext, loadedStore.getOwner())) {
        return catalogs;
    } else {
        return catalogItemFinder.findVisibleCatalogItems(catalog, catalogs, locale);
    }
}
Also used : ArrayList(java.util.ArrayList) Store(org.rembx.jeeshop.catalog.model.Store) Catalog(org.rembx.jeeshop.catalog.model.Catalog) PermitAll(javax.annotation.security.PermitAll)

Aggregations

PermitAll (javax.annotation.security.PermitAll)36 ArrayList (java.util.ArrayList)8 User (org.traccar.model.User)8 POST (javax.ws.rs.POST)7 GET (javax.ws.rs.GET)6 Path (javax.ws.rs.Path)6 HashMap (java.util.HashMap)5 RolesAllowed (javax.annotation.security.RolesAllowed)5 DataTable (io.irontest.models.DataTable)4 UserDefinedProperty (io.irontest.models.UserDefinedProperty)4 Date (java.util.Date)4 Produces (javax.ws.rs.Produces)4 WebApplicationException (javax.ws.rs.WebApplicationException)4 Catalog (org.rembx.jeeshop.catalog.model.Catalog)4 ObjectMapper (com.fasterxml.jackson.databind.ObjectMapper)3 Testcase (io.irontest.models.Testcase)3 HashSet (java.util.HashSet)3 LinkedHashMap (java.util.LinkedHashMap)3 JsonView (com.fasterxml.jackson.annotation.JsonView)2 Environment (io.irontest.models.Environment)2