#Simple MongoDB Security Tutorial
###1 - Start mongod without any "security option"
$ mongod --port 27017
httpClient.DefaultRequestHeaders.Authorization = | |
new AuthenticationHeaderValue( | |
"Basic", | |
Convert.ToBase64String( | |
System.Text.ASCIIEncoding.ASCII.GetBytes( | |
string.Format("{0}:{1}", username, password)))); |
public List<ProfileDocument> searchByTechnology(String technology) throws Exception { | |
SearchRequest searchRequest = new SearchRequest(); | |
SearchSourceBuilder searchSourceBuilder = new SearchSourceBuilder(); | |
QueryBuilder queryBuilder = QueryBuilders | |
.boolQuery() | |
.must(QueryBuilders | |
.matchQuery("technologies.name", technology)); |
# Stop all containers | |
docker stop `docker ps -qa` | |
# Remove all containers | |
docker rm `docker ps -qa` | |
# Remove all images | |
docker rmi -f `docker images -qa ` | |
# Remove all volumes |
### BUILD image | |
FROM maven:3-jdk-11 as builder | |
#Copy Custom Maven settings | |
#COPY settings.xml /root/.m2/ | |
# create app folder for sources | |
RUN mkdir -p /build | |
WORKDIR /build | |
COPY pom.xml /build | |
#Download all required dependencies into one layer | |
RUN mvn -B dependency:resolve dependency:resolve-plugins |
package be.objectify.example.jooq; | |
import java.sql.SQLException; | |
import java.sql.SQLFeatureNotSupportedException; | |
import java.sql.Types; | |
import java.util.Objects; | |
import com.fasterxml.jackson.databind.JsonNode; | |
import org.jooq.Binding; | |
import org.jooq.BindingGetResultSetContext; | |
import org.jooq.BindingGetSQLInputContext; |
#Simple MongoDB Security Tutorial
###1 - Start mongod without any "security option"
$ mongod --port 27017
package sample; | |
import java.io.ByteArrayOutputStream; | |
import java.io.IOException; | |
import java.security.MessageDigest; | |
import java.security.SecureRandom; | |
import java.text.DateFormat; | |
import java.text.SimpleDateFormat; |
import org.apache.ws.security.WSConstants; | |
import org.apache.ws.security.message.WSSecHeader; | |
import org.apache.ws.security.message.WSSecUsernameToken; | |
import org.apache.ws.security.WSSConfig; | |
import org.apache.xalan.processor.TransformerFactoryImpl; | |
import org.apache.xerces.jaxp.DocumentBuilderFactoryImpl; | |
import org.w3c.dom.Document; | |
import org.w3c.dom.Element; | |
import javax.xml.transform.OutputKeys; |
###Create a project from Maven Template:
To start a new maven project, use the maven archetype plugin from the command line using the archetype:generate
goal.
The following command will tell maven to create a java project from maven-archetype-quickstart
template, if you ignore the archetypeArtifactId
argument, then a list of the templates will be listed for you to choose.
import javax.sql.DataSource; | |
import org.springframework.beans.factory.annotation.Autowired; | |
import org.springframework.beans.factory.annotation.Qualifier; | |
import org.springframework.boot.autoconfigure.jdbc.DataSourceBuilder; | |
import org.springframework.boot.context.properties.ConfigurationProperties; | |
import org.springframework.boot.context.properties.EnableConfigurationProperties; | |
import org.springframework.context.annotation.Bean; | |
import org.springframework.context.annotation.Configuration; |