code: public void verifySamlProfileRequestIfNeeded(final RequestAbstractType profileRequest,
                                                   final MetadataResolver resolver,
                                                   final HttpServletRequest request,
                                                   final MessageContext context) throws Exception {
  
          val roleDescriptorResolver = getRoleDescriptorResolver(resolver, context, profileRequest);
  
          LOGGER.debug("Validating signature for [{}]", profileRequest.getClass().getName());
  
          val signature = profileRequest.getSignature();
          if (signature != null) {
              validateSignatureOnProfileRequest(profileRequest, signature, roleDescriptorResolver);
          } else {
              validateSignatureOnAuthenticationRequest(profileRequest, request, context, roleDescriptorResolver);
          }
      }
docs: Verify saml profile request if needed.
  
  @param profileRequest the profile request
  @param resolver       the resolver
  @param request        the request
  @param context        the context
  @throws Exception the exception