Search in sources :

Example 16 with GetMapping

use of org.springframework.web.bind.annotation.GetMapping in project cas by apereo.

the class TrustedDevicesController method getRecords.

/**
 * Gets records.
 *
 * @param request  the request
 * @param response the response
 * @return the records
 */
@GetMapping(value = "/getRecords")
@ResponseBody
public Set<MultifactorAuthenticationTrustRecord> getRecords(final HttpServletRequest request, final HttpServletResponse response) {
    ensureEndpointAccessIsAuthorized(request, response);
    final TrustedDevicesMultifactorProperties trusted = casProperties.getAuthn().getMfa().getTrusted();
    final LocalDate onOrAfter = LocalDate.now().minus(trusted.getExpiration(), DateTimeUtils.toChronoUnit(trusted.getTimeUnit()));
    this.mfaTrustEngine.expire(onOrAfter);
    return this.mfaTrustEngine.get(onOrAfter);
}
Also used : TrustedDevicesMultifactorProperties(org.apereo.cas.configuration.model.support.mfa.TrustedDevicesMultifactorProperties) LocalDate(java.time.LocalDate) GetMapping(org.springframework.web.bind.annotation.GetMapping) ResponseBody(org.springframework.web.bind.annotation.ResponseBody)

Example 17 with GetMapping

use of org.springframework.web.bind.annotation.GetMapping in project cas by apereo.

the class CasConsentReviewController method showConsent.

/**
 * Show consent decisions.
 *
 * @param request  the request
 * @param response the response
 * @return the view where json data will be rendered
 */
@GetMapping
public ModelAndView showConsent(final HttpServletRequest request, final HttpServletResponse response) {
    final ModelAndView view = new ModelAndView(CONSENT_REVIEW_VIEW);
    view.getModel().put("principal", Pac4jUtils.getPac4jAuthenticatedUsername());
    return view;
}
Also used : ModelAndView(org.springframework.web.servlet.ModelAndView) GetMapping(org.springframework.web.bind.annotation.GetMapping)

Example 18 with GetMapping

use of org.springframework.web.bind.annotation.GetMapping in project uhgroupings by uhawaii-system-its-ti-iam.

the class HomeController method feedbackError.

@PreAuthorize("isAuthenticated()")
@GetMapping("/feedback/{error}")
public String feedbackError(RedirectAttributes redirectAttributes, @PathVariable String error) {
    Feedback feedback = new Feedback(error);
    redirectAttributes.addFlashAttribute("feedback", feedback);
    return "redirect:/feedback";
}
Also used : Feedback(edu.hawaii.its.groupings.type.Feedback) GetMapping(org.springframework.web.bind.annotation.GetMapping) PreAuthorize(org.springframework.security.access.prepost.PreAuthorize)

Example 19 with GetMapping

use of org.springframework.web.bind.annotation.GetMapping in project code-chill by CodeChillAlluna.

the class UserController method resetPassword.

@GetMapping(value = "/reset/{token}")
public ResponseEntity<?> resetPassword(@PathVariable("token") String token) {
    HttpHeaders responseHeaders = new HttpHeaders();
    User user = urepo.findByTokenPassword(token);
    Date currentDate = new Date();
    Calendar c = Calendar.getInstance();
    c.setTime(user.getLastPasswordResetDate());
    c.add(Calendar.DATE, 1);
    Date currentDatePlusOne = c.getTime();
    if (user != null) {
        if (currentDate.after(user.getLastPasswordResetDate()) && currentDate.before(currentDatePlusOne)) {
            return ResponseEntity.ok().headers(responseHeaders).body(user);
        }
    }
    return ResponseEntity.badRequest().headers(responseHeaders).body(null);
}
Also used : HttpHeaders(org.springframework.http.HttpHeaders) User(fr.codechill.spring.model.User) Calendar(java.util.Calendar) Date(java.util.Date) GetMapping(org.springframework.web.bind.annotation.GetMapping)

Example 20 with GetMapping

use of org.springframework.web.bind.annotation.GetMapping in project sic by belluccifranco.

the class PagoController method getPagosPorCajaYFormaDePago.

@GetMapping("/pagos/busqueda")
@ResponseStatus(HttpStatus.OK)
public List<Pago> getPagosPorCajaYFormaDePago(@RequestParam long idEmpresa, @RequestParam long idFormaDePago, @RequestParam long desde, @RequestParam long hasta) {
    Date fechaDesde = new Date(desde);
    Date fechaHasta = new Date(hasta);
    return pagoService.getPagosEntreFechasYFormaDePago(idEmpresa, idFormaDePago, fechaDesde, fechaHasta);
}
Also used : Date(java.util.Date) GetMapping(org.springframework.web.bind.annotation.GetMapping) ResponseStatus(org.springframework.web.bind.annotation.ResponseStatus)

Aggregations

GetMapping (org.springframework.web.bind.annotation.GetMapping)737 ResponseBody (org.springframework.web.bind.annotation.ResponseBody)114 ResponseEntity (org.springframework.http.ResponseEntity)78 ArrayList (java.util.ArrayList)52 ModelAndView (org.springframework.web.servlet.ModelAndView)48 List (java.util.List)46 WebMessageException (org.hisp.dhis.dxf2.webmessage.WebMessageException)45 HttpHeaders (org.springframework.http.HttpHeaders)40 HashMap (java.util.HashMap)38 lombok.val (lombok.val)38 Map (java.util.Map)37 ResponseStatus (org.springframework.web.bind.annotation.ResponseStatus)36 Grid (org.hisp.dhis.common.Grid)35 IOException (java.io.IOException)32 ApiOperation (io.swagger.annotations.ApiOperation)31 RootNode (org.hisp.dhis.node.types.RootNode)31 RequestParam (org.springframework.web.bind.annotation.RequestParam)31 PathVariable (org.springframework.web.bind.annotation.PathVariable)30 HttpServletRequest (javax.servlet.http.HttpServletRequest)29 FieldFilterParams (org.hisp.dhis.fieldfilter.FieldFilterParams)28