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();
}
}
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());
}
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);
}
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);
}
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);
}
}
Aggregations