This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!-- csrf form --> | |
<form class="mt-3 mb-3" action="/src/service.php" method="POST" onSubmit="appendToken()"> | |
<!-- csrf hidden input field --> | |
<input type="hidden" id="csrf_token" name="csrf_token" value="csrf" /> | |
<div class="form-group"> | |
<label for="php">Do you like PHP ?</label> | |
<input type="text" class="form-control" id="php" name="php" placeholder="not at all... ;) " required autofocus/> | |
</div> | |
<div class="form-group"> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$.ajax({ | |
url: 'serverURL', | |
type: 'post', | |
async: false, | |
data: { | |
'csrf_request': '<?php echo $_COOKIE['csrf_session_cookie'] ?>' | |
}, | |
success: function (data) { | |
// appending the token to an hidden input field named csrf_token | |
document.getElementById("csrf_token").value = data; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<project> | |
<modelVersion>4.0.0</modelVersion> | |
<groupId>build-all-services</groupId> | |
<artifactId>build-services</artifactId> | |
<packaging>pom</packaging> | |
<version>1.0.0</version> | |
<name>build-all-services</name> | |
<modules> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<project> | |
<!-- copy this section to your existing pom.xml --> | |
<!-- section: deploys the built artifact to the defined path --> | |
<build> | |
<!-- replace the name --> | |
<finalName>{{ jar/war name }}</finalName> | |
<plugins> | |
<plugin> | |
<groupId>org.apache.maven.plugins</groupId> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class SmartPhone { | |
private String modelNumber; | |
private String battery; | |
public static int numberOfObjects; | |
public SmartPhone (String modelNumber, String battery) { | |
this.modelNumber = modelNumber; | |
this.battery = battery; | |
numberOfObjects++; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class User { | |
List<String< convertedValue = Utility.convertStringToSomething("an input string here"); | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
# An hook script to verify changes to be committed do not contain | |
# any 'FIXME:' comments. Called by "git commit" with no arguments. | |
# | |
# The hook should exit with non-zero status after issuing an appropriate | |
# message if it stops the commit. | |
# | |
# To bypass this hook, use the "--no-verify" parameter when committing. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package <your package namespace>; | |
import org.apache.synapse.MessageContext; | |
import org.apache.synapse.commons.json.JsonUtil; | |
import org.apache.synapse.core.axis2.Axis2MessageContext; | |
import org.apache.synapse.mediators.AbstractMediator; | |
import org.json.JSONObject; | |
public class CustomMediator extends AbstractMediator { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@Override | |
public void handleEvent(Event event) throws IdentityEventException { | |
if (log.isDebugEnabled()) { | |
log.debug("handleEvent() invoked"); | |
} | |
if (IdentityEventConstants.Event.PRE_UPDATE_CREDENTIAL.equals(event.getEventName()) | |
|| IdentityEventConstants.Event.PRE_UPDATE_CREDENTIAL_BY_ADMIN.equals(event.getEventName())) { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@Activate | |
protected void activate(ComponentContext context) { | |
try { | |
context.getBundleContext().registerService(AbstractEventHandler.class.getName(), | |
new DefectivePasswordValidatorEventHandler(), null); | |
// initialize all defective passwords from the text file | |
DefaultDefectivePasswordValidator.getInstance().initValues(); |
OlderNewer