Skip to content
Snippets Groups Projects

Compare revisions

Changes are shown as if the source revision was being merged into the target revision. Learn more about comparing revisions.

Source

Select target project
No results found

Target

Select target project
No results found
Show changes
Commits on Source (38)
Showing
with 716 additions and 0 deletions
*/out/
*/target/
*/.idea/workspace.xml
*/.idea/tasks.xml
*.iws
<component name="ArtifactManager">
<artifact type="war" name="IdentityService:war">
<output-path>$PROJECT_DIR$/target</output-path>
<root id="archive" name="IdentityService-1.0-SNAPSHOT.war">
<element id="artifact" artifact-name="IdentityService:war exploded" />
</root>
</artifact>
</component>
\ No newline at end of file
<component name="ArtifactManager">
<artifact type="exploded-war" name="IdentityService:war exploded">
<output-path>$PROJECT_DIR$/target/IdentityService-1.0-SNAPSHOT</output-path>
<root id="root">
<element id="directory" name="WEB-INF">
<element id="directory" name="classes">
<element id="module-output" name="IdentityService" />
</element>
<element id="directory" name="lib">
<element id="library" level="project" name="Maven: mysql:mysql-connector-java:5.1.6" />
<element id="library" level="project" name="Maven: com.google.code.gson:gson:2.8.2" />
</element>
</element>
<element id="directory" name="META-INF">
<element id="file-copy" path="$PROJECT_DIR$/target/IdentityService-1.0-SNAPSHOT/META-INF/MANIFEST.MF" />
</element>
<element id="javaee-facet-resources" facet="IdentityService/web/Web" />
</root>
</artifact>
</component>
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="CompilerConfiguration">
<annotationProcessing>
<profile name="Maven default annotation processors profile" enabled="true">
<sourceOutputDir name="target/generated-sources/annotations" />
<sourceTestOutputDir name="target/generated-test-sources/test-annotations" />
<outputRelativeToContentRoot value="true" />
<module name="IdentityService" />
</profile>
</annotationProcessing>
<bytecodeTargetLevel>
<module name="IdentityService" target="1.7" />
</bytecodeTargetLevel>
</component>
</project>
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="dataSourceStorageLocal">
<data-source name="db_ojek@localhost" uuid="73893ef9-edb6-4a40-b1cd-ff6a6138781a">
<database-info product="MySQL" version="5.5.5-10.1.19-MariaDB" jdbc-version="4.0" driver-name="MySQL Connector Java" driver-version="mysql-connector-java-5.1.44 ( Revision: b3cda4f864902ffdde495b9df93937c3e20009be )">
<extra-name-characters>#@</extra-name-characters>
<identifier-quote-string>`</identifier-quote-string>
</database-info>
<case-sensitivity plain-identifiers="lower" quoted-identifiers="lower" />
<secret-storage>master_key</secret-storage>
<user-name>root</user-name>
<introspection-schemas>*:db_ojek</introspection-schemas>
</data-source>
</component>
</project>
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="DataSourceManagerImpl" format="xml" multifile-model="true">
<data-source source="LOCAL" name="db_ojek@localhost" uuid="73893ef9-edb6-4a40-b1cd-ff6a6138781a">
<driver-ref>mysql</driver-ref>
<synchronize>true</synchronize>
<jdbc-driver>com.mysql.jdbc.Driver</jdbc-driver>
<jdbc-url>jdbc:mysql://localhost:3306/db_ojek</jdbc-url>
<driver-properties>
<property name="autoReconnect" value="true" />
<property name="zeroDateTimeBehavior" value="convertToNull" />
<property name="tinyInt1isBit" value="false" />
<property name="characterEncoding" value="utf8" />
<property name="characterSetResults" value="utf8" />
<property name="yearIsDateType" value="false" />
</driver-properties>
</data-source>
</component>
</project>
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8"?>
<dataSource name="db_ojek@localhost">
<database-model serializer="dbm" rdbms="MYSQL" format-version="4.4">
<root id="1"/>
<schema id="2" parent="1" name="db_ojek">
<Current>1</Current>
<Visible>1</Visible>
</schema>
<schema id="3" parent="1" name="information_schema"/>
<schema id="4" parent="1" name="laundry"/>
<schema id="5" parent="1" name="laundryx"/>
<schema id="6" parent="1" name="mysql"/>
<schema id="7" parent="1" name="performance_schema"/>
<schema id="8" parent="1" name="phpmyadmin"/>
<schema id="9" parent="1" name="test"/>
<schema id="10" parent="1" name="universitasx"/>
<schema id="11" parent="1" name="wbd_projek"/>
<table id="12" parent="2" name="pref_loc"/>
<table id="13" parent="2" name="rating_driver"/>
<table id="14" parent="2" name="transaction"/>
<column id="15" parent="12" name="IDDriver">
<Position>1</Position>
<DataType>int(11)|0</DataType>
<NotNull>1</NotNull>
</column>
<column id="16" parent="12" name="Location">
<Position>2</Position>
<DataType>varchar(30)|0</DataType>
<NotNull>1</NotNull>
</column>
<column id="17" parent="13" name="IDDriver">
<Position>1</Position>
<DataType>int(11)|0</DataType>
<NotNull>1</NotNull>
</column>
<column id="18" parent="13" name="rating">
<Position>2</Position>
<DataType>float|0</DataType>
<NotNull>1</NotNull>
</column>
<column id="19" parent="13" name="totalvote">
<Position>3</Position>
<DataType>int(11)|0</DataType>
<NotNull>1</NotNull>
</column>
<key id="20" parent="13" name="PRIMARY">
<NameSurrogate>1</NameSurrogate>
<ColNames>IDDriver</ColNames>
<Primary>1</Primary>
</key>
<column id="21" parent="14" name="IDTransaksi">
<Position>1</Position>
<DataType>int(11)|0</DataType>
<NotNull>1</NotNull>
</column>
<column id="22" parent="14" name="IDDriver">
<Position>2</Position>
<DataType>int(11)|0</DataType>
<NotNull>1</NotNull>
</column>
<column id="23" parent="14" name="IDPenumpang">
<Position>3</Position>
<DataType>int(10)|0</DataType>
<NotNull>1</NotNull>
</column>
<column id="24" parent="14" name="LokasiAwal">
<Position>4</Position>
<DataType>varchar(30)|0</DataType>
<NotNull>1</NotNull>
</column>
<column id="25" parent="14" name="LokasiTujuan">
<Position>5</Position>
<DataType>varchar(30)|0</DataType>
<NotNull>1</NotNull>
</column>
<column id="26" parent="14" name="Rating">
<Position>6</Position>
<DataType>int(11)|0</DataType>
<NotNull>1</NotNull>
</column>
<column id="27" parent="14" name="Comment">
<Position>7</Position>
<DataType>varchar(120)|0</DataType>
<NotNull>1</NotNull>
</column>
<column id="28" parent="14" name="IsHide">
<Position>8</Position>
<DataType>tinyint(1)|0</DataType>
<NotNull>1</NotNull>
</column>
<column id="29" parent="14" name="DatePosted">
<Position>9</Position>
<DataType>date|0</DataType>
<NotNull>1</NotNull>
</column>
<key id="30" parent="14" name="PRIMARY">
<NameSurrogate>1</NameSurrogate>
<ColNames>IDTransaksi</ColNames>
<Primary>1</Primary>
</key>
</database-model>
</dataSource>
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="Encoding">
<file url="file://$PROJECT_DIR$" charset="UTF-8" />
</component>
</project>
\ No newline at end of file
<component name="libraryTable">
<library name="Maven: com.google.code.gson:gson:2.8.2">
<CLASSES>
<root url="jar://$MAVEN_REPOSITORY$/com/google/code/gson/gson/2.8.2/gson-2.8.2.jar!/" />
</CLASSES>
<JAVADOC>
<root url="jar://$MAVEN_REPOSITORY$/com/google/code/gson/gson/2.8.2/gson-2.8.2-javadoc.jar!/" />
</JAVADOC>
<SOURCES>
<root url="jar://$MAVEN_REPOSITORY$/com/google/code/gson/gson/2.8.2/gson-2.8.2-sources.jar!/" />
</SOURCES>
</library>
</component>
\ No newline at end of file
<component name="libraryTable">
<library name="Maven: javax:javaee-web-api:7.0">
<CLASSES>
<root url="jar://$MAVEN_REPOSITORY$/javax/javaee-web-api/7.0/javaee-web-api-7.0.jar!/" />
</CLASSES>
<JAVADOC>
<root url="jar://$MAVEN_REPOSITORY$/javax/javaee-web-api/7.0/javaee-web-api-7.0-javadoc.jar!/" />
</JAVADOC>
<SOURCES>
<root url="jar://$MAVEN_REPOSITORY$/javax/javaee-web-api/7.0/javaee-web-api-7.0-sources.jar!/" />
</SOURCES>
</library>
</component>
\ No newline at end of file
<component name="libraryTable">
<library name="Maven: mysql:mysql-connector-java:5.1.6">
<CLASSES>
<root url="jar://$MAVEN_REPOSITORY$/mysql/mysql-connector-java/5.1.6/mysql-connector-java-5.1.6.jar!/" />
</CLASSES>
<JAVADOC>
<root url="jar://$MAVEN_REPOSITORY$/mysql/mysql-connector-java/5.1.6/mysql-connector-java-5.1.6-javadoc.jar!/" />
</JAVADOC>
<SOURCES>
<root url="jar://$MAVEN_REPOSITORY$/mysql/mysql-connector-java/5.1.6/mysql-connector-java-5.1.6-sources.jar!/" />
</SOURCES>
</library>
</component>
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="FrameworkDetectionExcludesConfiguration">
<file type="web" url="file://$PROJECT_DIR$" />
</component>
<component name="MavenProjectsManager">
<option name="originalFiles">
<list>
<option value="$PROJECT_DIR$/pom.xml" />
</list>
</option>
</component>
<component name="ProjectRootManager" version="2" languageLevel="JDK_1_8" default="true" project-jdk-name="1.8" project-jdk-type="JavaSDK">
<output url="file://$PROJECT_DIR$/out" />
</component>
</project>
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="ProjectModuleManager">
<modules>
<module fileurl="file://$PROJECT_DIR$/IdentityService.iml" filepath="$PROJECT_DIR$/IdentityService.iml" />
</modules>
</component>
</project>
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="SqlDialectMappings">
<file url="file://$PROJECT_DIR$/data/db_ojek_account.sql" dialect="MySQL" />
</component>
</project>
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="Palette2">
<group name="Swing">
<item class="com.intellij.uiDesigner.HSpacer" tooltip-text="Horizontal Spacer" icon="/com/intellij/uiDesigner/icons/hspacer.png" removable="false" auto-create-binding="false" can-attach-label="false">
<default-constraints vsize-policy="1" hsize-policy="6" anchor="0" fill="1" />
</item>
<item class="com.intellij.uiDesigner.VSpacer" tooltip-text="Vertical Spacer" icon="/com/intellij/uiDesigner/icons/vspacer.png" removable="false" auto-create-binding="false" can-attach-label="false">
<default-constraints vsize-policy="6" hsize-policy="1" anchor="0" fill="2" />
</item>
<item class="javax.swing.JPanel" icon="/com/intellij/uiDesigner/icons/panel.png" removable="false" auto-create-binding="false" can-attach-label="false">
<default-constraints vsize-policy="3" hsize-policy="3" anchor="0" fill="3" />
</item>
<item class="javax.swing.JScrollPane" icon="/com/intellij/uiDesigner/icons/scrollPane.png" removable="false" auto-create-binding="false" can-attach-label="true">
<default-constraints vsize-policy="7" hsize-policy="7" anchor="0" fill="3" />
</item>
<item class="javax.swing.JButton" icon="/com/intellij/uiDesigner/icons/button.png" removable="false" auto-create-binding="true" can-attach-label="false">
<default-constraints vsize-policy="0" hsize-policy="3" anchor="0" fill="1" />
<initial-values>
<property name="text" value="Button" />
</initial-values>
</item>
<item class="javax.swing.JRadioButton" icon="/com/intellij/uiDesigner/icons/radioButton.png" removable="false" auto-create-binding="true" can-attach-label="false">
<default-constraints vsize-policy="0" hsize-policy="3" anchor="8" fill="0" />
<initial-values>
<property name="text" value="RadioButton" />
</initial-values>
</item>
<item class="javax.swing.JCheckBox" icon="/com/intellij/uiDesigner/icons/checkBox.png" removable="false" auto-create-binding="true" can-attach-label="false">
<default-constraints vsize-policy="0" hsize-policy="3" anchor="8" fill="0" />
<initial-values>
<property name="text" value="CheckBox" />
</initial-values>
</item>
<item class="javax.swing.JLabel" icon="/com/intellij/uiDesigner/icons/label.png" removable="false" auto-create-binding="false" can-attach-label="false">
<default-constraints vsize-policy="0" hsize-policy="0" anchor="8" fill="0" />
<initial-values>
<property name="text" value="Label" />
</initial-values>
</item>
<item class="javax.swing.JTextField" icon="/com/intellij/uiDesigner/icons/textField.png" removable="false" auto-create-binding="true" can-attach-label="true">
<default-constraints vsize-policy="0" hsize-policy="6" anchor="8" fill="1">
<preferred-size width="150" height="-1" />
</default-constraints>
</item>
<item class="javax.swing.JPasswordField" icon="/com/intellij/uiDesigner/icons/passwordField.png" removable="false" auto-create-binding="true" can-attach-label="true">
<default-constraints vsize-policy="0" hsize-policy="6" anchor="8" fill="1">
<preferred-size width="150" height="-1" />
</default-constraints>
</item>
<item class="javax.swing.JFormattedTextField" icon="/com/intellij/uiDesigner/icons/formattedTextField.png" removable="false" auto-create-binding="true" can-attach-label="true">
<default-constraints vsize-policy="0" hsize-policy="6" anchor="8" fill="1">
<preferred-size width="150" height="-1" />
</default-constraints>
</item>
<item class="javax.swing.JTextArea" icon="/com/intellij/uiDesigner/icons/textArea.png" removable="false" auto-create-binding="true" can-attach-label="true">
<default-constraints vsize-policy="6" hsize-policy="6" anchor="0" fill="3">
<preferred-size width="150" height="50" />
</default-constraints>
</item>
<item class="javax.swing.JTextPane" icon="/com/intellij/uiDesigner/icons/textPane.png" removable="false" auto-create-binding="true" can-attach-label="true">
<default-constraints vsize-policy="6" hsize-policy="6" anchor="0" fill="3">
<preferred-size width="150" height="50" />
</default-constraints>
</item>
<item class="javax.swing.JEditorPane" icon="/com/intellij/uiDesigner/icons/editorPane.png" removable="false" auto-create-binding="true" can-attach-label="true">
<default-constraints vsize-policy="6" hsize-policy="6" anchor="0" fill="3">
<preferred-size width="150" height="50" />
</default-constraints>
</item>
<item class="javax.swing.JComboBox" icon="/com/intellij/uiDesigner/icons/comboBox.png" removable="false" auto-create-binding="true" can-attach-label="true">
<default-constraints vsize-policy="0" hsize-policy="2" anchor="8" fill="1" />
</item>
<item class="javax.swing.JTable" icon="/com/intellij/uiDesigner/icons/table.png" removable="false" auto-create-binding="true" can-attach-label="false">
<default-constraints vsize-policy="6" hsize-policy="6" anchor="0" fill="3">
<preferred-size width="150" height="50" />
</default-constraints>
</item>
<item class="javax.swing.JList" icon="/com/intellij/uiDesigner/icons/list.png" removable="false" auto-create-binding="true" can-attach-label="false">
<default-constraints vsize-policy="6" hsize-policy="2" anchor="0" fill="3">
<preferred-size width="150" height="50" />
</default-constraints>
</item>
<item class="javax.swing.JTree" icon="/com/intellij/uiDesigner/icons/tree.png" removable="false" auto-create-binding="true" can-attach-label="false">
<default-constraints vsize-policy="6" hsize-policy="6" anchor="0" fill="3">
<preferred-size width="150" height="50" />
</default-constraints>
</item>
<item class="javax.swing.JTabbedPane" icon="/com/intellij/uiDesigner/icons/tabbedPane.png" removable="false" auto-create-binding="true" can-attach-label="false">
<default-constraints vsize-policy="3" hsize-policy="3" anchor="0" fill="3">
<preferred-size width="200" height="200" />
</default-constraints>
</item>
<item class="javax.swing.JSplitPane" icon="/com/intellij/uiDesigner/icons/splitPane.png" removable="false" auto-create-binding="false" can-attach-label="false">
<default-constraints vsize-policy="3" hsize-policy="3" anchor="0" fill="3">
<preferred-size width="200" height="200" />
</default-constraints>
</item>
<item class="javax.swing.JSpinner" icon="/com/intellij/uiDesigner/icons/spinner.png" removable="false" auto-create-binding="true" can-attach-label="true">
<default-constraints vsize-policy="0" hsize-policy="6" anchor="8" fill="1" />
</item>
<item class="javax.swing.JSlider" icon="/com/intellij/uiDesigner/icons/slider.png" removable="false" auto-create-binding="true" can-attach-label="false">
<default-constraints vsize-policy="0" hsize-policy="6" anchor="8" fill="1" />
</item>
<item class="javax.swing.JSeparator" icon="/com/intellij/uiDesigner/icons/separator.png" removable="false" auto-create-binding="false" can-attach-label="false">
<default-constraints vsize-policy="6" hsize-policy="6" anchor="0" fill="3" />
</item>
<item class="javax.swing.JProgressBar" icon="/com/intellij/uiDesigner/icons/progressbar.png" removable="false" auto-create-binding="true" can-attach-label="false">
<default-constraints vsize-policy="0" hsize-policy="6" anchor="0" fill="1" />
</item>
<item class="javax.swing.JToolBar" icon="/com/intellij/uiDesigner/icons/toolbar.png" removable="false" auto-create-binding="false" can-attach-label="false">
<default-constraints vsize-policy="0" hsize-policy="6" anchor="0" fill="1">
<preferred-size width="-1" height="20" />
</default-constraints>
</item>
<item class="javax.swing.JToolBar$Separator" icon="/com/intellij/uiDesigner/icons/toolbarSeparator.png" removable="false" auto-create-binding="false" can-attach-label="false">
<default-constraints vsize-policy="0" hsize-policy="0" anchor="0" fill="1" />
</item>
<item class="javax.swing.JScrollBar" icon="/com/intellij/uiDesigner/icons/scrollbar.png" removable="false" auto-create-binding="true" can-attach-label="false">
<default-constraints vsize-policy="6" hsize-policy="0" anchor="0" fill="2" />
</item>
</group>
</component>
</project>
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="VcsDirectoryMappings">
<mapping directory="$PROJECT_DIR$/.." vcs="Git" />
</component>
</project>
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8"?>
<module org.jetbrains.idea.maven.project.MavenProjectsManager.isMavenModule="true" type="JAVA_MODULE" version="4">
<component name="FacetManager">
<facet type="web" name="Web">
<configuration>
<descriptors>
<deploymentDescriptor name="web.xml" url="file://$MODULE_DIR$/web/WEB-INF/web.xml" />
</descriptors>
<webroots>
<root url="file://$MODULE_DIR$/src/main/webapp" relative="/" />
</webroots>
<sourceRoots>
<root url="file://$MODULE_DIR$/src/main/java" />
<root url="file://$MODULE_DIR$/src/main/resources" />
<root url="file://$MODULE_DIR$/target" />
</sourceRoots>
</configuration>
</facet>
</component>
<component name="NewModuleRootManager" LANGUAGE_LEVEL="JDK_1_7">
<output url="file://$MODULE_DIR$/target/classes" />
<output-test url="file://$MODULE_DIR$/target/test-classes" />
<content url="file://$MODULE_DIR$">
<sourceFolder url="file://$MODULE_DIR$/src/main/java" isTestSource="false" />
<sourceFolder url="file://$MODULE_DIR$/src/main/resources" type="java-resource" />
<sourceFolder url="file://$MODULE_DIR$/src/test/java" isTestSource="true" />
<sourceFolder url="file://$MODULE_DIR$/target" isTestSource="false" />
<excludeFolder url="file://$MODULE_DIR$/target" />
</content>
<orderEntry type="inheritedJdk" />
<orderEntry type="sourceFolder" forTests="false" />
<orderEntry type="library" scope="PROVIDED" name="Tomcat 7.0.82" level="application_server_libraries" />
<orderEntry type="library" exported="" name="mysql:mysql-connector-java:6.0.6" level="application" />
<orderEntry type="library" exported="" name="com.google.code.gson:gson:2.8.2" level="application" />
<orderEntry type="library" scope="PROVIDED" name="Maven: javax:javaee-web-api:7.0" level="project" />
<orderEntry type="library" name="Maven: mysql:mysql-connector-java:5.1.6" level="project" />
<orderEntry type="library" name="Maven: com.google.code.gson:gson:2.8.2" level="project" />
</component>
</module>
\ No newline at end of file
-- phpMyAdmin SQL Dump
-- version 4.5.4.1deb2ubuntu2
-- http://www.phpmyadmin.net
--
-- Host: localhost
-- Generation Time: 07 Nov 2017 pada 16.42
-- Versi Server: 10.0.31-MariaDB-0ubuntu0.16.04.2
-- PHP Version: 7.0.22-0ubuntu0.16.04.1
SET SQL_MODE = "NO_AUTO_VALUE_ON_ZERO";
SET time_zone = "+00:00";
/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */;
/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */;
/*!40101 SET NAMES utf8mb4 */;
--
-- Database: `db_ojek_account`
--
-- --------------------------------------------------------
--
-- Struktur dari tabel `account`
--
CREATE TABLE `account` (
`id` int(15) NOT NULL,
`name` varchar(50) NOT NULL,
`username` varchar(20) NOT NULL,
`email` varchar(40) NOT NULL,
`password` varchar(100) NOT NULL,
`phone` varchar(15) NOT NULL,
`photo` varchar(100) NOT NULL,
`is_driver` tinyint(1) NOT NULL DEFAULT '0'
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
--
-- Dumping data untuk tabel `account`
--
INSERT INTO `account` (`id`, `name`, `username`, `email`, `password`, `phone`, `photo`, `is_driver`) VALUES
(1, 'Fadhil Imam', 'fadhilimamk', '13515146@std.stei.itb.ac.id', 'ac43724f16e9241d990427ab7c8f4228', '085797490039', '/img/profile/VGdWZUZ2dlJlUkM5eWpjVDcyQXJoZz09', 1),
(2, 'Joko Susilo', 'jokosusilo', 'rahasia@gmail.com', 'ac43724f16e9241d990427ab7c8f4228', '0247624517', '/img/profile/cXNNb1RtOXg0ckxtUVpoZGpiK3NTZz09', 1),
(3, 'Abdul Majid', 'abdulmajid', 'abdul@gmail.com', 'jhasdTUAShasdbasdjask', '085741627404', '/img/profile/R2dXM01NcDVRV0lrVXdGTE5nbDZDdz09', 1),
(4, 'Abdullah Malik Ibrahim', 'malikibrahim', 'malik@gmail.com', 'ac43724f16e9241d990427ab7c8f4228', '0247657917', '/img/profile/UFBqemxTWmtkZytjSmNSVWE4S2lTQT09', 1),
(5, 'Joko Akbar', 'joko', 'jokoakbar@gmail.com', 'ac43724f16e9241d990427ab7c8f4228', '085797490039', '/img/empty_profile.png', 0),
(6, 'Lifardi Muhammad', 'lifardi', 'lifardi@gmail.com', 'ac43724f16e9241d990427ab7c8f4228', '085797490039', '/img/empty_profile.png', 1),
(7, 'Coba 3', 'coba', 'coba@gmail.com', 'coba', '085797490039', '/img/empty_profile.png', 0),
(8, 'Fadhil Imam', 'fadhil', 'fadhil@itb.ac.id', 'ac43724f16e9241d990427ab7c8f4228', '0872318283192', '/img/empty_profile.png', 0);
-- --------------------------------------------------------
--
-- Struktur dari tabel `token`
--
CREATE TABLE `token` (
`token` varchar(100) NOT NULL,
`created_at` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
`expire_at` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
`id_account` int(11) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
--
-- Dumping data untuk tabel `token`
--
INSERT INTO `token` (`token`, `created_at`, `expire_at`, `id_account`) VALUES
('5a9da397ca3949981d3b61f31c365a5aa3a1dd24ec73f244ba987f66e860faf8', '2017-11-07 09:11:59', '2017-11-07 09:16:59', 1),
('84ad58d5e1fea4b479bce138484682715b9f3a0b264e5e6c0dc157eb86023116', '2017-11-06 14:09:28', '2017-11-06 15:13:23', 5);
--
-- Indexes for dumped tables
--
--
-- Indexes for table `account`
--
ALTER TABLE `account`
ADD PRIMARY KEY (`id`),
ADD UNIQUE KEY `username` (`username`,`email`);
--
-- Indexes for table `token`
--
ALTER TABLE `token`
ADD PRIMARY KEY (`token`),
ADD UNIQUE KEY `id_account_2` (`id_account`),
ADD KEY `id_account` (`id_account`);
--
-- AUTO_INCREMENT for dumped tables
--
--
-- AUTO_INCREMENT for table `account`
--
ALTER TABLE `account`
MODIFY `id` int(15) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=9;
--
-- Ketidakleluasaan untuk tabel pelimpahan (Dumped Tables)
--
--
-- Ketidakleluasaan untuk tabel `token`
--
ALTER TABLE `token`
ADD CONSTRAINT `fk_token_account` FOREIGN KEY (`id_account`) REFERENCES `account` (`id`) ON DELETE CASCADE ON UPDATE CASCADE;
/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */;
/*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */;
/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>org.informatika.ojek</groupId>
<artifactId>IdentityService</artifactId>
<version>1.0-SNAPSHOT</version>
<packaging>war</packaging>
<name>IdentityService</name>
<properties>
<endorsed.dir>${project.build.directory}/endorsed</endorsed.dir>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>
<dependencies>
<dependency>
<groupId>javax</groupId>
<artifactId>javaee-web-api</artifactId>
<version>7.0</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>mysql</groupId>
<artifactId>mysql-connector-java</artifactId>
<version>5.1.6</version>
</dependency>
<dependency>
<groupId>com.google.code.gson</groupId>
<artifactId>gson</artifactId>
<version>2.8.2</version>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.1</version>
<configuration>
<source>1.7</source>
<target>1.7</target>
<compilerArguments>
<endorseddirs>${endorsed.dir}</endorseddirs>
</compilerArguments>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-war-plugin</artifactId>
<version>2.3</version>
<configuration>
<failOnMissingWebXml>false</failOnMissingWebXml>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-dependency-plugin</artifactId>
<version>2.6</version>
<executions>
<execution>
<phase>validate</phase>
<goals>
<goal>copy</goal>
</goals>
<configuration>
<outputDirectory>${endorsed.dir}</outputDirectory>
<silent>true</silent>
<artifactItems>
<artifactItem>
<groupId>javax</groupId>
<artifactId>javaee-endorsed-api</artifactId>
<version>7.0</version>
<type>jar</type>
</artifactItem>
</artifactItems>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
</project>
package org.informatika.ojek;
import com.google.gson.Gson;
import org.informatika.ojek.model.Account;
import org.informatika.ojek.model.Response;
import java.io.IOException;
import java.io.PrintWriter;
import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
/**
*
* @author fadhilimamk
*/
@WebServlet(name = "Auth", urlPatterns = {"/auth"})
public class Auth extends HttpServlet {
private DAO DAO;
private Gson gson;
public void init() {
String jdbcURL = getServletContext().getInitParameter("jdbcURL");
String jdbcUsername = getServletContext().getInitParameter("jdbcUsername");
String jdbcPassword = getServletContext().getInitParameter("jdbcPassword");
DAO = new DAO(jdbcURL, jdbcUsername, jdbcPassword);
gson = new Gson();
}
@Override
protected void doPost(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException {
response.setContentType("text/html;charset=UTF-8");
response.setStatus(500);
PrintWriter out = response.getWriter();
String username = request.getParameter("username");
String password = request.getParameter("password");
Response data;
// Check username and password in post body
if (username == null || password == null) {
data = new Response(Response.STATUS_ERROR, null, null, "Wrong parameter!");
out.print(gson.toJson(data));
return;
}
Account account = DAO.checkAvaibility(username, password);
// Return error if user not exist
if (account == null) {
data = new Response(Response.STATUS_ERROR, null, null, "Wrong username or password!");
out.print(gson.toJson(data));
return;
}
// Return old token if user already login before
String token = DAO.checkUserAlreadyLogin(account.getId());
if (token != null) {
data = new Response(Response.STATUS_SUCCESS, token, null, "User already login before!");
out.print(gson.toJson(data));
return;
}
// Generate new token
try {
token = account.generateToken(password);
DAO.createToken(account.getId(), token);
} catch (Exception e) {
data = new Response(Response.STATUS_ERROR, null, null, e.getMessage());
out.print( gson.toJson(data));
return;
}
response.setStatus(200);
data = new Response(Response.STATUS_SUCCESS, token, null, null);
out.print(gson.toJson(data));
}
}