LPS-25621 Apply to plugins

This is applying the same for the plugins what @KocsisDaniel has coded here: https://github.com/rotty3000/liferay-portal/pull/313

Since this is security, it's essential to have the same code working here.

Thanks,

Máté

cc: @JorgeFerrer