Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
<?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="vokmar" />
</profile>
</annotationProcessing>
</component>
</project>
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="Encoding">
<file url="file://$PROJECT_DIR$" charset="UTF-8" />
<file url="PROJECT" charset="UTF-8" />
</component>
</project>
<component name="InspectionProjectProfileManager">
<profile version="1.0">
<option name="myName" value="Project Default" />
<inspection_tool class="SingleElementAnnotation" enabled="false" level="INFORMATION" enabled_by_default="false" />
</profile>
</component>
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="ExternalStorageConfigurationManager" enabled="true" />
<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" project-jdk-name="1.8" project-jdk-type="JavaSDK">
<output url="file://$PROJECT_DIR$/out" />
</component>
</project>
<?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>
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="ArtifactsWorkspaceSettings">
<artifacts-to-build>
<artifact name="vokmar:war exploded" />
</artifacts-to-build>
</component>
<component name="ChangeListManager">
<list default="true" id="fd94a09c-12ea-413e-8f70-017d06499958" name="Default Changelist" comment="" />
<option name="EXCLUDED_CONVERTED_TO_IGNORED" value="true" />
<option name="SHOW_DIALOG" value="false" />
<option name="HIGHLIGHT_CONFLICTS" value="true" />
<option name="HIGHLIGHT_NON_ACTIVE_CHANGELIST" value="false" />
<option name="LAST_RESOLUTION" value="IGNORE" />
</component>
<component name="CompilerWorkspaceConfiguration">
<option name="MAKE_PROJECT_ON_SAVE" value="true" />
</component>
<component name="DatabaseView">
<option name="SHOW_INTERMEDIATE" value="true" />
<option name="GROUP_DATA_SOURCES" value="true" />
<option name="GROUP_SCHEMA" value="true" />
<option name="GROUP_CONTENTS" value="false" />
<option name="SORT_POSITIONED" value="false" />
<option name="SHOW_EMPTY_GROUPS" value="false" />
<option name="AUTO_SCROLL_FROM_SOURCE" value="false" />
<option name="HIDDEN_KINDS">
<set />
</option>
<expand />
<select />
</component>
<component name="FavoritesManager">
<favorites_list name="vokmar" />
</component>
<component name="FileTemplateManagerImpl">
<option name="RECENT_TEMPLATES">
<list>
<option value="Kotlin Class" />
<option value="CSS File" />
<option value="JavaScript File" />
<option value="Interface" />
<option value="HTML File" />
<option value="Class" />
</list>
</option>
</component>
<component name="JavaeeView">
<option name="showModules" value="false" />
</component>
<component name="JsFlowSettings">
<service-enabled>true</service-enabled>
<exe-path />
<other-services-enabled>true</other-services-enabled>
<auto-save>true</auto-save>
</component>
<component name="LogFilters">
<option name="FILTER_ERRORS" value="false" />
<option name="FILTER_WARNINGS" value="false" />
<option name="FILTER_INFO" value="false" />
<option name="FILTER_DEBUG" value="false" />
<option name="CUSTOM_FILTER" value="" />
</component>
<component name="MavenImportPreferences">
<option name="importingSettings">
<MavenImportingSettings>
<option name="importAutomatically" value="true" />
</MavenImportingSettings>
</option>
</component>
<component name="ProjectId" id="1YS6PnLkflOW2lmmlbKH5iu6shz" />
<component name="PropertiesComponent">
<property name="DefaultHtmlFileTemplate" value="HTML File" />
<property name="WebServerToolWindowFactoryState" value="false" />
<property name="aspect.path.notification.shown" value="true" />
<property name="com.intellij.ide.scratch.LRUPopupBuilder$1/New Scratch File" value="XML" />
<property name="last_opened_file_path" value="$PROJECT_DIR$/src/main/webapp/WEB-INF/pages/error" />
<property name="list.type.of.created.stylesheet" value="CSS" />
<property name="node.js.detected.package.eslint" value="true" />
<property name="node.js.detected.package.tslint" value="true" />
<property name="node.js.path.for.package.eslint" value="project" />
<property name="node.js.path.for.package.tslint" value="project" />
<property name="node.js.selected.package.eslint" value="(autodetect)" />
<property name="node.js.selected.package.tslint" value="(autodetect)" />
<property name="nodejs_package_manager_path" value="npm" />
<property name="project.structure.last.edited" value="Artifacts" />
<property name="project.structure.proportion" value="0.15" />
<property name="project.structure.side.proportion" value="0.2" />
<property name="settings.editor.selected.configurable" value="MavenSettings" />
</component>
<component name="RecentsManager">
<key name="CopyFile.RECENT_KEYS">
<recent name="C:\Users\pavel\IdeaProjects\vokmar\src\main\webapp\WEB-INF\pages\error" />
<recent name="C:\Users\pavel\IdeaProjects\vokmar\src\main\webapp\WEB-INF\pages" />
<recent name="C:\Users\pavel\IdeaProjects\vokmar\src\main\webapp\WEB-INF\pages\ajax" />
<recent name="C:\Users\pavel\IdeaProjects\vokmar\src\main\webapp\js" />
<recent name="C:\Users\pavel\IdeaProjects\vokmar\src\main\resources\js" />
</key>
<key name="CopyClassDialog.RECENTS_KEY">
<recent name="com.admin.zakaz.vendor.entity" />
<recent name="ru.boq.vokmar.config.servise" />
</key>
<key name="MoveFile.RECENT_KEYS">
<recent name="C:\Users\pavel\IdeaProjects\vokmar\src\main\webapp\WEB-INF\pages" />
<recent name="C:\Users\pavel\IdeaProjects\vokmar\src\main\webapp\resources" />
<recent name="C:\Users\pavel\IdeaProjects\vokmar\src\main\webapp" />
<recent name="C:\Users\pavel\IdeaProjects\vokmar\target\maven-archiver" />
</key>
</component>
<component name="RunAnythingCache">
<option name="myCommands">
<command value="mvn compile" />
</option>
</component>
<component name="RunDashboard">
<option name="ruleStates">
<list>
<RuleState>
<option name="name" value="ConfigurationTypeDashboardGroupingRule" />
</RuleState>
<RuleState>
<option name="name" value="StatusDashboardGroupingRule" />
</RuleState>
</list>
</option>
</component>
<component name="RunManager">
<configuration name="Tomcat 9.0.31" type="#com.intellij.j2ee.web.tomcat.TomcatRunConfigurationFactory" factoryName="Local" APPLICATION_SERVER_NAME="Tomcat 9.0.31" ALTERNATIVE_JRE_ENABLED="false" nameIsGenerated="true">
<option name="BROWSER_ID" value="16bf23d4-93e0-4ffc-bfd6-cb13575177b0" />
<option name="UPDATE_ON_FRAME_DEACTIVATION" value="true" />
<option name="UPDATE_CLASSES_ON_FRAME_DEACTIVATION" value="true" />
<option name="SHOW_DIALOG_ON_UPDATE" value="false" />
<deployment>
<artifact name="vokmar:war exploded">
<settings>
<option name="CONTEXT_PATH" value="" />
</settings>
</artifact>
</deployment>
<server-settings>
<option name="BASE_DIRECTORY_NAME" value="Tomcat_9_0_31_vokmar_2" />
</server-settings>
<log_file alias="Tomcat Manager Log" path="%IDEA_RUN:CATALINA_BASE%/logs/manager.*" />
<log_file alias="Tomcat Host Manager Log" path="%IDEA_RUN:CATALINA_BASE%/logs/host-manager.*" />
<predefined_log_file enabled="true" id="Tomcat" />
<predefined_log_file enabled="true" id="Tomcat Catalina" />
<predefined_log_file enabled="true" id="Tomcat Localhost Access" />
<RunnerSettings RunnerId="Debug">
<option name="DEBUG_PORT" value="53753" />
</RunnerSettings>
<ConfigurationWrapper VM_VAR="JAVA_OPTS" RunnerId="Cover">
<option name="USE_ENV_VARIABLES" value="true" />
<STARTUP>
<option name="USE_DEFAULT" value="true" />
<option name="SCRIPT" value="" />
<option name="VM_PARAMETERS" value="" />
<option name="PROGRAM_PARAMETERS" value="" />
</STARTUP>
<SHUTDOWN>
<option name="USE_DEFAULT" value="true" />
<option name="SCRIPT" value="" />
<option name="VM_PARAMETERS" value="" />
<option name="PROGRAM_PARAMETERS" value="" />
</SHUTDOWN>
</ConfigurationWrapper>
<ConfigurationWrapper VM_VAR="JAVA_OPTS" RunnerId="Debug">
<option name="USE_ENV_VARIABLES" value="true" />
<STARTUP>
<option name="USE_DEFAULT" value="true" />
<option name="SCRIPT" value="" />
<option name="VM_PARAMETERS" value="" />
<option name="PROGRAM_PARAMETERS" value="" />
</STARTUP>
<SHUTDOWN>
<option name="USE_DEFAULT" value="true" />
<option name="SCRIPT" value="" />
<option name="VM_PARAMETERS" value="" />
<option name="PROGRAM_PARAMETERS" value="" />
</SHUTDOWN>
</ConfigurationWrapper>
<ConfigurationWrapper VM_VAR="JAVA_OPTS" RunnerId="Run">
<option name="USE_ENV_VARIABLES" value="true" />
<STARTUP>
<option name="USE_DEFAULT" value="true" />
<option name="SCRIPT" value="" />
<option name="VM_PARAMETERS" value="" />
<option name="PROGRAM_PARAMETERS" value="" />
</STARTUP>
<SHUTDOWN>
<option name="USE_DEFAULT" value="true" />
<option name="SCRIPT" value="" />
<option name="VM_PARAMETERS" value="" />
<option name="PROGRAM_PARAMETERS" value="" />
</SHUTDOWN>
</ConfigurationWrapper>
<method v="2">
<option name="BuildArtifacts" enabled="true">
<artifact name="vokmar:war exploded" />
</option>
<option name="MakeProject" enabled="true" />
</method>
</configuration>
<configuration default="true" type="#com.intellij.j2ee.web.tomcat.TomcatRunConfigurationFactory" factoryName="Local" APPLICATION_SERVER_NAME="Tomcat 9.0.31" ALTERNATIVE_JRE_ENABLED="false">
<option name="BROWSER_ID" value="16bf23d4-93e0-4ffc-bfd6-cb13575177b0" />
<option name="UPDATING_POLICY" value="restart-server" />
<deployment>
<artifact name="vokmar:war exploded">
<settings>
<option name="CONTEXT_PATH" value="" />
</settings>
</artifact>
</deployment>
<server-settings>
<option name="BASE_DIRECTORY_NAME" value="_vokmar" />
</server-settings>
<predefined_log_file enabled="true" id="Tomcat" />
<predefined_log_file enabled="true" id="Tomcat Catalina" />
<predefined_log_file id="Tomcat Manager" />
<predefined_log_file id="Tomcat Host Manager" />
<predefined_log_file id="Tomcat Localhost Access" />
<RunnerSettings RunnerId="Debug">
<option name="DEBUG_PORT" value="53753" />
</RunnerSettings>
<ConfigurationWrapper VM_VAR="JAVA_OPTS" RunnerId="Cover">
<option name="USE_ENV_VARIABLES" value="true" />
<STARTUP>
<option name="USE_DEFAULT" value="true" />
<option name="SCRIPT" value="" />
<option name="VM_PARAMETERS" value="" />
<option name="PROGRAM_PARAMETERS" value="" />
</STARTUP>
<SHUTDOWN>
<option name="USE_DEFAULT" value="true" />
<option name="SCRIPT" value="" />
<option name="VM_PARAMETERS" value="" />
<option name="PROGRAM_PARAMETERS" value="" />
</SHUTDOWN>
</ConfigurationWrapper>
<ConfigurationWrapper VM_VAR="JAVA_OPTS" RunnerId="Debug">
<option name="USE_ENV_VARIABLES" value="true" />
<STARTUP>
<option name="USE_DEFAULT" value="true" />
<option name="SCRIPT" value="" />
<option name="VM_PARAMETERS" value="" />
<option name="PROGRAM_PARAMETERS" value="" />
</STARTUP>
<SHUTDOWN>
<option name="USE_DEFAULT" value="true" />
<option name="SCRIPT" value="" />
<option name="VM_PARAMETERS" value="" />
<option name="PROGRAM_PARAMETERS" value="" />
</SHUTDOWN>
</ConfigurationWrapper>
<ConfigurationWrapper VM_VAR="JAVA_OPTS" RunnerId="Run">
<option name="USE_ENV_VARIABLES" value="true" />
<STARTUP>
<option name="USE_DEFAULT" value="true" />
<option name="SCRIPT" value="" />
<option name="VM_PARAMETERS" value="" />
<option name="PROGRAM_PARAMETERS" value="" />
</STARTUP>
<SHUTDOWN>
<option name="USE_DEFAULT" value="true" />
<option name="SCRIPT" value="" />
<option name="VM_PARAMETERS" value="" />
<option name="PROGRAM_PARAMETERS" value="" />
</SHUTDOWN>
</ConfigurationWrapper>
<method v="2">
<option name="MakeProject" enabled="true" />
</method>
</configuration>
<configuration default="true" type="#com.intellij.j2ee.web.tomcat.TomcatRunConfigurationFactory" factoryName="Remote" ALTERNATIVE_JRE_ENABLED="false">
<option name="LOCAL" value="false" />
<deployment />
<server-settings>
<data>
<option name="targets">
<list>
<WatchedTargetModelImpl>
<option name="name" value="CONTEXT_XML" />
<name>CONTEXT_XML</name>
</WatchedTargetModelImpl>
<StagingTargetModelImpl>
<option name="name" value="STAGING" />
<name>STAGING</name>
</StagingTargetModelImpl>
</list>
</option>
<option name="transportHostId" />
</data>
</server-settings>
<predefined_log_file enabled="true" id="Tomcat" />
<predefined_log_file enabled="true" id="TOMCAT_LOCALHOST_LOG_ID" />
<RunnerSettings RunnerId="Debug">
<option name="DEBUG_PORT" value="57580" />
<option name="LOCAL" value="false" />
</RunnerSettings>
<method v="2">
<option name="Make" enabled="true" />
</method>
</configuration>
</component>
<component name="SpringBeansView">
<option name="beanDetailsProportion" value="0.3" />
</component>
<component name="SvnConfiguration">
<configuration />
</component>
<component name="TaskManager">
<task active="true" id="Default" summary="Default task">
<changelist id="fd94a09c-12ea-413e-8f70-017d06499958" name="Default Changelist" comment="" />
<created>1582923627233</created>
<option name="number" value="Default" />
<option name="presentableId" value="Default" />
<updated>1582923627233</updated>
<workItem from="1582923631389" duration="1658000" />
<workItem from="1582988003468" duration="11334000" />
<workItem from="1583001336039" duration="3706000" />
<workItem from="1583009268524" duration="862000" />
<workItem from="1583010364118" duration="508000" />
<workItem from="1583011674353" duration="60000" />
<workItem from="1583084145099" duration="11516000" />
<workItem from="1583175204733" duration="10107000" />
<workItem from="1583207337215" duration="1122000" />
<workItem from="1583263739328" duration="8721000" />
<workItem from="1583294014992" duration="747000" />
<workItem from="1583350433887" duration="8350000" />
<workItem from="1583360032312" duration="338000" />
<workItem from="1583380473610" duration="754000" />
<workItem from="1583436979725" duration="8153000" />
<workItem from="1583521905371" duration="6408000" />
<workItem from="1583702491850" duration="7123000" />
<workItem from="1583780588010" duration="12947000" />
<workItem from="1583812749653" duration="797000" />
<workItem from="1583868269548" duration="7183000" />
<workItem from="1583952445214" duration="5787000" />
<workItem from="1584128953164" duration="2855000" />
<workItem from="1584133468164" duration="348000" />
<workItem from="1584135389143" duration="7829000" />
<workItem from="1584174592271" duration="179000" />
<workItem from="1584221139512" duration="785000" />
<workItem from="1584227933865" duration="5994000" />
<workItem from="1584387633477" duration="6865000" />
<workItem from="1584475742665" duration="7352000" />
<workItem from="1584561234025" duration="7451000" />
<workItem from="1584646143063" duration="8661000" />
<workItem from="1584787028480" duration="1229000" />
<workItem from="1584819647561" duration="6238000" />
<workItem from="1584832720977" duration="5221000" />
<workItem from="1584907966458" duration="9722000" />
<workItem from="1585079256323" duration="6922000" />
<workItem from="1585165098970" duration="4833000" />
<workItem from="1585201776649" duration="26959000" />
<workItem from="1585290164387" duration="19719000" />
<workItem from="1585479090375" duration="7541000" />
<workItem from="1585552511581" duration="7881000" />
<workItem from="1585597817030" duration="6526000" />
<workItem from="1585681265885" duration="7740000" />
<workItem from="1585754929175" duration="20347000" />
<workItem from="1585855082143" duration="7333000" />
<workItem from="1585942930805" duration="9346000" />
<workItem from="1585953006197" duration="7725000" />
<workItem from="1586148543640" duration="4701000" />
<workItem from="1586182267229" duration="6547000" />
<workItem from="1586199181832" duration="3184000" />
<workItem from="1586234534555" duration="4468000" />
<workItem from="1586278347319" duration="10209000" />
<workItem from="1586372508894" duration="8303000" />
<workItem from="1586522556418" duration="11266000" />
<workItem from="1586599689575" duration="1602000" />
<workItem from="1586713363929" duration="5017000" />
<workItem from="1586754036127" duration="3156000" />
<workItem from="1586806908814" duration="9198000" />
<workItem from="1586895097874" duration="6112000" />
<workItem from="1587105823185" duration="17113000" />
<workItem from="1587162597991" duration="3879000" />
<workItem from="1587476685456" duration="15260000" />
<workItem from="1587572945074" duration="12150000" />
<workItem from="1587667075131" duration="10207000" />
<workItem from="1587732277353" duration="21366000" />
<workItem from="1587981013097" duration="13375000" />
<workItem from="1588007325345" duration="10693000" />
<workItem from="1588091986157" duration="10464000" />
<workItem from="1588184894877" duration="5413000" />
<workItem from="1588275069864" duration="1037000" />
<workItem from="1588277281279" duration="3581000" />
<workItem from="1588366063955" duration="2367000" />
<workItem from="1588515037109" duration="4152000" />
<workItem from="1588572335414" duration="5909000" />
<workItem from="1588587759302" duration="14598000" />
<workItem from="1588704901431" duration="8223000" />
<workItem from="1588795691665" duration="6902000" />
<workItem from="1588872396066" duration="10679000" />
<workItem from="1588933969457" duration="13603000" />
<workItem from="1588976353675" duration="421000" />
<workItem from="1589063955858" duration="5608000" />
<workItem from="1589111377033" duration="9836000" />
<workItem from="1589229019140" duration="8189000" />
<workItem from="1589269825199" duration="2949000" />
</task>
<servers />
</component>
<component name="TypeScriptGeneratedFilesManager">
<option name="version" value="1" />
</component>
<component name="XDebuggerManager">
<breakpoint-manager>
<breakpoints>
<line-breakpoint enabled="true" type="java-line">
<url>file://$PROJECT_DIR$/src/main/java/secyriry/service/UserService.java</url>
<line>37</line>
<option name="timeStamp" value="7" />
</line-breakpoint>
<line-breakpoint enabled="true" type="java-line">
<url>file://$PROJECT_DIR$/src/main/java/secyriry/authentication/CustomAuthencationProvider.java</url>
<line>50</line>
<option name="timeStamp" value="76" />
</line-breakpoint>
<line-breakpoint enabled="true" type="java-line">
<url>file://$PROJECT_DIR$/src/main/java/secyriry/authentication/CustomAuthencationProvider.java</url>
<line>54</line>
<option name="timeStamp" value="78" />
</line-breakpoint>
<line-breakpoint enabled="true" type="java-line">
<url>file://$PROJECT_DIR$/src/main/java/secyriry/authentication/loginpassworld/User.java</url>
<line>13</line>
<option name="timeStamp" value="104" />
</line-breakpoint>
<line-breakpoint enabled="true" type="java-line">
<url>file://$PROJECT_DIR$/src/main/java/secyriry/authentication/loginpassworld/CustomUserDetailsService.java</url>
<line>5</line>
<option name="timeStamp" value="106" />
</line-breakpoint>
<line-breakpoint enabled="true" type="java-line">
<url>file://$PROJECT_DIR$/src/main/java/ru/boq/vokmar/config/WebSecurityConfig.java</url>
<line>41</line>
<option name="timeStamp" value="109" />
</line-breakpoint>
<line-breakpoint enabled="true" type="java-line">
<url>file://$PROJECT_DIR$/src/main/java/secyriry/authentication/loginpassworld/CustomUserDetailsAuthenticationProvider.java</url>
<line>64</line>
<option name="timeStamp" value="123" />
</line-breakpoint>
<line-breakpoint enabled="true" type="java-line">
<url>file://$PROJECT_DIR$/src/main/java/secyriry/service/EncodingFilter.java</url>
<line>11</line>
<option name="timeStamp" value="133" />
</line-breakpoint>
<line-breakpoint enabled="true" type="java-line">
<url>file://$PROJECT_DIR$/src/main/java/secyriry/authentication/loginpassworld/CustomUserDetailsAuthenticationProvider.java</url>
<line>68</line>
<option name="timeStamp" value="138" />
</line-breakpoint>
<line-breakpoint enabled="true" type="java-method">
<url>file://$PROJECT_DIR$/src/main/java/secyriry/authentication/CustomAuthencationProvider.java</url>
<line>44</line>
<properties class="secyriry.authentication.CustomAuthencationProvider" method="authenticate">
<option name="EMULATED" value="true" />
</properties>
<option name="timeStamp" value="80" />
</line-breakpoint>
<line-breakpoint enabled="true" type="java-method">
<url>file://$PROJECT_DIR$/src/main/java/secyriry/authentication/loginpassworld/CustomUserDetailsAuthenticationProvider.java</url>
<line>59</line>
<properties class="secyriry.authentication.loginpassworld.CustomUserDetailsAuthenticationProvider" method="doAfterPropertiesSet">
<option name="EMULATED" value="true" />
</properties>
<option name="timeStamp" value="94" />
</line-breakpoint>
</breakpoints>
</breakpoint-manager>
<watches-manager>
<configuration name="#com.intellij.j2ee.web.tomcat.TomcatRunConfigurationFactory">
<watch expression="auth" />
<watch expression="filters" />
<watch expression="filters" language="JAVA" />
<watch expression="filters" />
<watch expression="filters" />
<watch expression="errors1.get(0)" />
<watch expression="((CustomUserDetailsServiceImpl)userDetailsService).userRepository" custom="secyriry.authentication.loginpassworld.CustomUserDetailsServiceImpl" />
<watch expression="errors1.get(1)" />
<watch expression="((HandlerMethod)handler).description" custom="org.springframework.web.method.HandlerMethod" />
<watch expression="this" />
<watch expression="this" language="JAVA" />
<watch expression="((CustomUserDetailsServiceImpl)userDetailsService).userRepository" custom="secyriry.authentication.loginpassworld.CustomUserDetailsServiceImpl" />
<watch expression="((CustomUserDetailsServiceImpl)userDetailsService).userRepository" custom="secyriry.authentication.loginpassworld.CustomUserDetailsServiceImpl" />
<watch expression="((CustomUserDetailsServiceImpl)userDetailsService).userRepository" custom="secyriry.authentication.loginpassworld.CustomUserDetailsServiceImpl" />
</configuration>
</watches-manager>
</component>
</project>
<?xml version="1.0" encoding="UTF-8"?>
<Context path="/">
</Context>
<?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>ru.boq.vokmar</groupId>
<artifactId>vokmar</artifactId>
<version>1.0-SNAPSHOT</version>
<packaging>war</packaging>
<name>vokmar</name>
<!-- FIXME change it to the project's website -->
<url>http://www.example.com</url>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
<maven.compiler.source>1.7</maven.compiler.source>
<maven.compiler.target>1.7</maven.compiler.target>
<failOnMissingWebXml>false</failOnMissingWebXml>
<jakartaee>8.0</jakartaee>
<spring.version>5.2.3.RELEASE</spring.version>
<jstl.version>1.2.1</jstl.version>
<tld.version>1.1.2</tld.version>
<servlets.version>3.1.0</servlets.version>
<jsp.version>2.3.1</jsp.version>
<hibernate.version>5.4.10.Finall</hibernate.version>
<kotlin.version>1.0.0</kotlin.version>
</properties>
<dependencies>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.11</version>
<scope>test</scope>
</dependency>
<!-- https://mvnrepository.com/artifact/org.springframework/spring-core -->
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-core</artifactId>
<version>5.2.4.RELEASE</version>
</dependency>
<dependency>
<groupId>javax</groupId>
<artifactId>javaee-api</artifactId>
<version>8.0.1</version>
</dependency>
<!-- Spring-->
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-webmvc</artifactId>
<version>${spring.version}</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-context</artifactId>
<version>${spring.version}</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-orm</artifactId>
<version>${spring.version}</version>
</dependency>
<dependency>
<groupId>org.springframework.data</groupId>
<artifactId>spring-data-jpa</artifactId>
<version>2.2.4.RELEASE</version>
</dependency>
<!-- -->
<!--servlet-->
<dependency>
<groupId>javax.servlet</groupId>
<artifactId>javax.servlet-api</artifactId>
<version>3.1.0</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>javax.servlet.jsp</groupId>
<artifactId>javax.servlet.jsp-api</artifactId>
<version>2.3.1</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>taglibs</groupId>
<artifactId>standard</artifactId>
<version>${tld.version}</version>
</dependency>
<dependency>
<groupId>jstl</groupId>
<artifactId>jstl</artifactId>
<version>1.2</version>
</dependency>
<!-- https://mvnrepository.com/artifact/com.fasterxml.jackson.module/jackson-module-kotlin -->
<dependency>
<groupId>com.fasterxml.jackson.module</groupId>
<artifactId>jackson-module-kotlin</artifactId>
<version>2.10.3</version>
</dependency>
<!-- https://mvnrepository.com/artifact/com.fasterxml.jackson.core/jackson-core -->
<dependency>
<groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-core</artifactId>
<version>2.10.3</version>
</dependency>
<!-- https://mvnrepository.com/artifact/com.fasterxml.jackson.core/jackson-databind -->
<dependency>
<groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-databind</artifactId>
<version>2.10.3</version>
</dependency>
<!--Hibernet-->
<!-- https://mvnrepository.com/artifact/org.hibernate/hibernate-core -->
<dependency>
<groupId>org.hibernate</groupId>
<artifactId>hibernate-core</artifactId>
<version>5.4.10.Final</version>
</dependency>
<dependency>
<groupId>org.hibernate</groupId>
<artifactId>hibernate-entitymanager</artifactId>
<version>5.4.10.Final</version>
</dependency>
<!-- https://mvnrepository.com/artifact/org.hibernate.validator/hibernate-validator -->
<dependency>
<groupId>org.hibernate.validator</groupId>
<artifactId>hibernate-validator</artifactId>
<version>6.1.2.Final</version>
</dependency>
<dependency>
<groupId>org.hibernate</groupId>
<artifactId>hibernate-osgi</artifactId>
<version>5.4.10.Final</version>
</dependency>
<!-- https://mvnrepository.com/artifact/mysql/mysql-connector-java -->
<dependency>
<groupId>mysql</groupId>
<artifactId>mysql-connector-java</artifactId>
<version>8.0.18</version>
</dependency>
<!-- https://mvnrepository.com/artifact/com.querydsl/querydsl-core -->
<dependency>
<groupId>com.querydsl</groupId>
<artifactId>querydsl-core</artifactId>
<version>4.1.0</version>
</dependency>
<!-- https://mvnrepository.com/artifact/com.querydsl/querydsl-jpa -->
<dependency>
<groupId>com.querydsl</groupId>
<artifactId>querydsl-jpa</artifactId>
<version>4.2.2</version>
</dependency>
<!-- https://mvnrepository.com/artifact/commons-dbcp/commons-dbcp -->
<dependency>
<groupId>commons-dbcp</groupId>
<artifactId>commons-dbcp</artifactId>
<version>1.4</version>
</dependency>
<!-- Thymeleaf-->
<!-- https://mvnrepository.com/artifact/org.thymeleaf/thymeleaf-spring5 -->
<dependency>
<groupId>org.thymeleaf</groupId>
<artifactId>thymeleaf-spring5</artifactId>
<version>3.0.11.RELEASE</version>
</dependency>
<!-- Spring Secyriti -->
<dependency>
<groupId>org.springframework.security</groupId>
<artifactId>spring-security-core</artifactId>
<version>5.2.2.RELEASE</version>
</dependency>
<dependency>
<groupId>org.springframework.security</groupId>
<artifactId>spring-security-config</artifactId>
<version>5.2.2.RELEASE</version>
<type>jar</type>
</dependency>
<!-- https://mvnrepository.com/artifact/org.springframework.batch/spring-batch-core -->
<dependency>
<groupId>org.springframework.batch</groupId>
<artifactId>spring-batch-core</artifactId>
<version>4.2.1.RELEASE</version>
</dependency>
<!-- https://mvnrepository.com/artifact/org.springframework.security/spring-security-web -->
<dependency>
<groupId>org.springframework.security</groupId>
<artifactId>spring-security-web</artifactId>
<version>5.2.2.RELEASE</version>
</dependency>
<!-- https://mvnrepository.com/artifact/org.thymeleaf.extras/thymeleaf-extras-springsecurity3 -->
<dependency>
<groupId>org.thymeleaf.extras</groupId>
<artifactId>thymeleaf-extras-springsecurity3</artifactId>
<version>3.0.4.RELEASE</version>
</dependency>
<!-- https://mvnrepository.com/artifact/org.apache.commons/commons-lang3 -->
<dependency>
<groupId>org.apache.commons</groupId>
<artifactId>commons-lang3</artifactId>
<version>3.0</version>
</dependency>
</dependencies>
<build>
<pluginManagement><!-- lock down plugins versions to avoid using Maven defaults (may be moved to parent pom) -->
<plugins>
<!-- clean lifecycle, see https://maven.apache.org/ref/current/maven-core/lifecycles.html#clean_Lifecycle -->
<plugin>
<artifactId>maven-clean-plugin</artifactId>
<version>3.1.0</version>
</plugin>
<!-- default lifecycle, jar packaging: see https://maven.apache.org/ref/current/maven-core/default-bindings.html#Plugin_bindings_for_jar_packaging -->
<plugin>
<artifactId>maven-resources-plugin</artifactId>
<version>3.0.2</version>
<configuration>
<encoding>${project.build.sourceEncoding}</encoding>
</configuration>
</plugin>
<plugin>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.8.0</version>
<configuration>
<encoding>${project.build.sourceEncoding}</encoding>
</configuration>
</plugin>
<plugin>
<artifactId>maven-surefire-plugin</artifactId>
<version>2.22.1</version>
<configuration>
<encoding>${project.build.sourceEncoding}</encoding>
</configuration>
</plugin>
<plugin>
<artifactId>maven-jar-plugin</artifactId>
<version>3.0.2</version>
</plugin>
<plugin>
<artifactId>maven-install-plugin</artifactId>
<version>2.5.2</version>
</plugin>
<plugin>
<artifactId>maven-deploy-plugin</artifactId>
<version>2.8.2</version>
</plugin>
<!-- site lifecycle, see https://maven.apache.org/ref/current/maven-core/lifecycles.html#site_Lifecycle -->
<plugin>
<artifactId>maven-site-plugin</artifactId>
<version>3.7.1</version>
</plugin>
<plugin>
<artifactId>maven-project-info-reports-plugin</artifactId>
<version>3.0.0</version>
</plugin>
</plugins>
</pluginManagement>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<executions>
<execution>
<id>compile</id>
<phase>compile</phase>
<goals>
<goal>compile</goal>
</goals>
</execution>
<execution>
<id>testCompile</id>
<phase>test-compile</phase>
<goals>
<goal>testCompile</goal>
</goals>
</execution>
</executions>
<configuration>
<encoding>${project.build.sourceEncoding}</encoding>
<source>8</source>
<target>8</target>
</configuration>
</plugin>
</plugins>
</build>
</project>
package com.admin.zakaz.vendor.controller;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.servlet.NoHandlerFoundException;
@ControllerAdvice
public class AdviceController {
// Обработка страницы 404
@ExceptionHandler(NoHandlerFoundException.class)
public String handle(Exception ex) {
return "error/page404";
}
@GetMapping("/403")
public String error403() {
return "error/page403";
}
}
package com.admin.zakaz.vendor.controller;
import com.admin.zakaz.vendor.entity.Vendor;
import com.admin.zakaz.vendor.servise.VendorServise;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.MediaType;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.validation.BindingResult;
import org.springframework.validation.FieldError;
import org.springframework.web.bind.annotation.*;
import secyriry.service.UserService;
import javax.validation.Valid;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;
@Controller
public class VendorController {
@Autowired
private VendorServise sv;
//@PreAuthorize("isAuthenticated()")
@PreAuthorize("hasRole('USER')")
@RequestMapping(value = "/ok", method = RequestMethod.GET)
public String ok(Model mu) {
Vendor venNev = new Vendor();
//venNev.setId((long) 1); // Для нового объекта устнавливаем id=1, чтобы можно было выполнять валидацию объекта
List<Vendor> df = sv.findByName(); // Получение всех записей и передача их в модель
mu.addAttribute("vendor", df);
mu.addAttribute("newvend",venNev);
return "ok";
}
@RequestMapping(value = "/ok/edit")
public String edit(@RequestParam long id, @RequestParam long v, Model model) {
//ModelAndView mav = new ModelAndView("edit_customer");
Vendor vend = sv.getId(id);
model.addAttribute("stys", v);
model.addAttribute("vendor", vend);
return "edit_customer";
}
@PreAuthorize("isAuthenticated()")
@RequestMapping(value = "/ok/vendor", method = RequestMethod.POST)
public String createVendor (@ModelAttribute("vendor") @Valid Vendor vend, BindingResult bindingResult, Model model){
if (bindingResult.hasErrors()) {
return "edit_customer";
}
Vendor nr = (Vendor) model.getAttribute("vendor");
sv.getCreateVokmar(nr);
return "redirect:/ok";
}
@PreAuthorize("isAuthenticated()")
@RequestMapping(value = "/vend.new", method = RequestMethod.POST)
public String newVendor (@ModelAttribute("newvend") @Valid Vendor vend, BindingResult bindingResult, Model model){
if (bindingResult.hasErrors()) {
return "redirect:/ok";
}
sv.getInsertVokmar(vend);
return "redirect:/ok";
}
// Обработка Ajax запроса
@RequestMapping(value = "/vendajax", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_VALUE)
@ResponseBody
public Vendor newVendorAjax (@Valid @RequestBody Vendor vend, BindingResult bindingResult, Model model){
if (bindingResult.hasErrors()) {
Vendor venNev = new Vendor();
// Формируем карту ошибок
Map<String, String> errors3 = new HashMap<>();
List<FieldError> errors1 = bindingResult.getFieldErrors();
Integer i=0;
for (FieldError error : errors1 ) {
errors3.put(""+i++,error.getDefaultMessage());
}
venNev.setValidated(true);
venNev.setErrorMessages(errors3);
return venNev;
}
vend.setValidated(false);
return sv.getInsertVokmar(vend);
}
@PreAuthorize("isAuthenticated()")
@RequestMapping(value = "edits")
@ResponseBody
public String editAjax(@RequestParam long id, @RequestParam long v, Model model) {
//ModelAndView mav = new ModelAndView("edit_customer");
Vendor vend = sv.getId(id);
model.addAttribute("stys", v);
model.addAttribute("vendor", vend);
return "edit_customer";
}
@PreAuthorize("isAuthenticated()")
@RequestMapping(value = "/ok/delete", method = RequestMethod.GET)
public String Delete(@RequestParam long id, Model mu) {
sv.getDeleteVokmar(id);
return "redirect:/ok";
}
@PreAuthorize("isAuthenticated()")
@RequestMapping(value = "ok/delete/all", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_VALUE)
@ResponseBody
public boolean Delete_ALL_Ajax(@RequestBody List<Vendor> vendors) {
sv.getDeleteAll_id(vendors);
return true;
}
}
package com.admin.zakaz.vendor.entity;
import javax.persistence.*;
import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Size;
import java.io.Serializable;
import java.util.Map;
@Entity
// Выбор всех элементов таблицы
@NamedQueries({@NamedQuery(name= Vendor.FIND_ALL, query="SELECT cc FROM Vendor cc")})
@Table(name = "VENDORS")
public class Vendor implements Serializable {
public static final String FIND_ALL = "Vendor.findByName";
public Vendor() {}
// Идентификатор поставщика в базе данных
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
@Column(name = "VENDOR_ID")
private Long id;
// Тип поставщика (без указания типа юридического лица)
@Column(name = "VENDOR_NAME")
@NotBlank(message = "Тип не может быть пустым")
@Size(min = 2, max = 50, message = "Минимальное значение 2 знака,\n максимальное 50")
private String name;
@Column(name = "VENDOR_DESC")
@Size(max = 150, message = "Максимальное количество знаков 150")
private String desc;
public Long getId() {
return id;
}
public void setId(Long id) {
this.id = id;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public String getDesc() {return desc; }
public void setDesc(String desc) {this.desc = desc;}
/*
validated - false в метаде Ajax будут выводится ошибки из карты ошибок
errorMessages - карта ошибок
*/
@Transient // не хранится в БД
private boolean validated;
// Хранится массив ошибок
@Transient
private Map<String, String> errorMessages;
public void setValidated(boolean validated) {
this.validated = validated;
}
public void setErrorMessages(Map<String, String> errorMessages) {
this.errorMessages = errorMessages;
}
public Map<String, String> getErrorMessages() {
return errorMessages;
}
public boolean isValidated() {
return validated;
}
}
package com.admin.zakaz.vendor.repository;
import com.admin.zakaz.vendor.entity.Vendor;
import org.springframework.data.repository.CrudRepository;
public interface VendorRepository extends CrudRepository<Vendor, Long> {
@Override
void deleteAll(Iterable<? extends Vendor> entities);
}
package com.admin.zakaz.vendor.servise;
import com.admin.zakaz.vendor.entity.Vendor;
import org.springframework.data.repository.CrudRepository;
import java.util.List;
public interface VendorServise {
List<Vendor> findByName(); // выборка всех данных из таблицы Vendor
Vendor getId(Long id); // Получение id из таблицы Vendor
void getCreateVokmar(Vendor vendor); // Обновление данных в БД
Vendor getInsertVokmar(Vendor vendor); // Вставка новых даных в БД
void getDeleteVokmar(long id); // Удаление записи из таблицы Vendorb
boolean getDeleteAll_id(List<Vendor> vendors); // Удаляем список запесей по id=> 12,36,46,45...
}
package com.admin.zakaz.vendor.servise;
import com.admin.zakaz.vendor.entity.Vendor;
import com.admin.zakaz.vendor.repository.VendorRepository;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Repository;
import org.springframework.stereotype.Service;
import javax.persistence.EntityManager;
import javax.persistence.PersistenceContext;
import javax.persistence.Query;
import javax.persistence.TypedQuery;
import javax.transaction.Transactional;
import java.util.List;
@Service
@Repository
@Transactional
public class VendorSqlServise implements VendorServise {
@PersistenceContext()
private EntityManager em;
@Autowired
VendorRepository repositories;
@Override // Выбор всех строк таблицы
public List<Vendor> findByName() {
TypedQuery<Vendor> query = em.createNamedQuery(Vendor.FIND_ALL, Vendor.class);
return query.getResultList();
}
@Override // Поиск сущности по id
public Vendor getId(Long id) {
return em.find(Vendor.class, id);
}
@Override // Обновление сущности
public void getCreateVokmar(Vendor vendor) {em.merge(vendor);}
@Override // Вставка новой сущности
public Vendor getInsertVokmar(Vendor v) {
/*
Для выполнения проверки даных не сохраненных в БД в представлении добавляется новая сущность с id=1
чтобы сохранить сущность обнуляем id
*/
if (v.getId()!=null){
em.merge(v);
} else{
v.setId(null);
em.persist(v);
}
return v;
}
@Override
public void getDeleteVokmar(long id) {
Vendor obg = em.find(Vendor.class, id);
em.remove(obg);
}
@Override
public boolean getDeleteAll_id(List<Vendor> vendors) {
repositories.deleteAll(vendors);
return true;
}
}
package ru.boq.vokmar.config;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.ApplicationContext;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.ComponentScan;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.filter.CharacterEncodingFilter;
import org.springframework.web.servlet.ViewResolver;
import org.springframework.web.servlet.config.annotation.EnableWebMvc;
import org.springframework.web.servlet.config.annotation.ResourceHandlerRegistry;
import org.springframework.web.servlet.config.annotation.ViewControllerRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;
import org.thymeleaf.spring5.SpringTemplateEngine;
import org.thymeleaf.spring5.templateresolver.SpringResourceTemplateResolver;
import org.thymeleaf.spring5.view.ThymeleafViewResolver;
import org.thymeleaf.templatemode.TemplateMode;
@Configuration
@ComponentScan(basePackages = { "ru","secyriry", "com" })
@EnableWebMvc
public class ASdf implements WebMvcConfigurer {
@Autowired
ApplicationContext applicationContext;
//1. Creating SpringResourceTemplateResolver
@Bean
public SpringResourceTemplateResolver springTemplateResolver(){
SpringResourceTemplateResolver springTemplateResolver = new SpringResourceTemplateResolver();
springTemplateResolver.setCharacterEncoding("UTF-8");
springTemplateResolver.setApplicationContext(this.applicationContext);
springTemplateResolver.setPrefix("/WEB-INF/pages/");
springTemplateResolver.setSuffix(".html");
springTemplateResolver.setTemplateMode(TemplateMode.HTML);
springTemplateResolver.setCacheable(false); // Включаем динамическое обновление шаблона при проектировании
return springTemplateResolver;
}
//2. Creating SpringTemplateEngine
@Bean
public SpringTemplateEngine springTemplateEngine(){
SpringTemplateEngine springTemplateEngine = new SpringTemplateEngine();
springTemplateEngine.setTemplateResolver(springTemplateResolver());
return springTemplateEngine;
}
//3. Registering ThymeleafViewResolver
@Bean
public ViewResolver viewResolver(){
ThymeleafViewResolver viewResolver = new ThymeleafViewResolver();
viewResolver.setTemplateEngine(springTemplateEngine());
viewResolver.setCharacterEncoding("UTF-8");
viewResolver.setContentType("text/html;charset=UTF-8");
return viewResolver;
}
@Override
public void addResourceHandlers(ResourceHandlerRegistry registry) {
registry.
addResourceHandler("/resources/**")
.addResourceLocations("/resources/");
}
}
package ru.boq.vokmar.config;
import org.apache.commons.dbcp.BasicDataSource;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.ComponentScan;
import org.springframework.context.annotation.Configuration;
import org.springframework.data.jpa.repository.config.EnableJpaRepositories;
import org.springframework.orm.jpa.JpaTransactionManager;
import org.springframework.orm.jpa.JpaVendorAdapter;
import org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean;
import org.springframework.orm.jpa.vendor.HibernateJpaVendorAdapter;
import org.springframework.transaction.PlatformTransactionManager;
import org.springframework.transaction.annotation.EnableTransactionManagement;
import javax.persistence.EntityManagerFactory;
import javax.sql.DataSource;
import java.util.Properties;
@Configuration
@EnableJpaRepositories(basePackages = {"ru", "secyriry", "com"})
@ComponentScan(basePackages = { "ru", "secyriry", "com" })
@EnableTransactionManagement
public class DaraServisConfig {
@Bean
public DataSource dataSource() {
try {
BasicDataSource dataSource = new BasicDataSource();
dataSource.setUrl("jdbc:mysql://localhost:3306/mysqlo?" +
"useJDBCCompliantTimezoneShift=true" +
"&useLegacyDatetimeCode=false" +
"&serverTimezone=UTC" +
"&useSSL=false" +
"&useUnicode=true" +
"&connectionCollation=utf8_general_ci" +
"&characterSetResults=utf8" +
"&characterEncoding=utf-8");
dataSource.setUsername("root");
dataSource.setPassword("1vokmar2");
dataSource.setInitialSize(5);
dataSource.setMaxActive(10);
return dataSource;
} catch (Exception e) {
System.out.print("Ошибка" + e);
return null;
}
}
@Bean
public Properties hibernateProperties() {
Properties hibernateProp = new Properties();
hibernateProp.put("hibernate.dialect", "org.hibernate.dialect.MySQL8Dialect");
hibernateProp.put("hibernate.hbm2ddl.auto", "update"); //create
hibernateProp.put("hibernate.show_sql", true);
hibernateProp.put("hibernate.max_fetch_depth", 3);
hibernateProp.put("hibernate.jdbc.batch_size", 10);
hibernateProp.put("hibernate.jdbc.fetch_size", 50);
//Кодировка
hibernateProp.put("hibernate.connection.characterEncoding", "utf8");
hibernateProp.put("hibernate.connection.CharSet", "utf8");
hibernateProp.put("hibernate.connection.useUnicode", true);
return hibernateProp;
}
@Bean
public PlatformTransactionManager transactionManager() {
return new JpaTransactionManager(entityManagerFactory());
}
@Bean
public JpaVendorAdapter jpaVendorAdapter() {
return new HibernateJpaVendorAdapter();
}
@Bean
public EntityManagerFactory entityManagerFactory() {
LocalContainerEntityManagerFactoryBean factoryBean = new LocalContainerEntityManagerFactoryBean();
factoryBean.setPackagesToScan("ru","secyriry", "com");
factoryBean.setDataSource(dataSource());
factoryBean.setJpaVendorAdapter(new HibernateJpaVendorAdapter());
factoryBean.setJpaProperties(hibernateProperties());
factoryBean.setJpaVendorAdapter(jpaVendorAdapter());
factoryBean.afterPropertiesSet();
return factoryBean.getNativeEntityManagerFactory();
}
}
package ru.boq.vokmar.config;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Configuration;
import org.springframework.security.access.AccessDecisionManager;
import org.springframework.security.config.annotation.method.configuration.EnableGlobalMethodSecurity;
import org.springframework.security.config.annotation.method.configuration.GlobalMethodSecurityConfiguration;
@Configuration
@EnableGlobalMethodSecurity(prePostEnabled = true, securedEnabled = true)
public class MethodSecurityConfig extends GlobalMethodSecurityConfiguration {
}
package ru.boq.vokmar.config.servise;
import org.springframework.security.web.authentication.preauth.AbstractPreAuthenticatedProcessingFilter;
import org.springframework.stereotype.Component;
import javax.servlet.*;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
/*
Данный класс используется как фильтр для установки UTF-8, используется в конфигурации Security
*/
public class EncodingFilterConfig implements Filter {
@Override
public void doFilter(ServletRequest request, ServletResponse response, FilterChain chain)
throws IOException, ServletException {
request.setCharacterEncoding("UTF-8");
response.setContentType("text/html; charset=UTF-8");
chain.doFilter(request, response);
}
}
package ru.boq.vokmar.config.session;
import org.springframework.security.web.session.HttpSessionEventPublisher;
import javax.servlet.http.HttpSessionEvent;
public class SessionEventListener extends HttpSessionEventPublisher {
@Override
public void sessionCreated(HttpSessionEvent event) {
super.sessionCreated(event);
event.getSession().setMaxInactiveInterval(60*10);
}
@Override
public void sessionDestroyed(HttpSessionEvent event) {
super.sessionDestroyed(event);
}
}
package ru.boq.vokmar.config;
import org.springframework.security.web.context.AbstractSecurityWebApplicationInitializer;
public class SpringSecurityWebApplicationInitializer extends AbstractSecurityWebApplicationInitializer {
}
package ru.boq.vokmar.config;
import org.springframework.security.config.annotation.web.builders.HttpSecurity;
import org.springframework.security.web.authentication.www.BasicAuthenticationFilter;
import org.springframework.web.context.WebApplicationContext;
import org.springframework.web.filter.CharacterEncodingFilter;
import org.springframework.web.filter.DelegatingFilterProxy;
import org.springframework.web.filter.HiddenHttpMethodFilter;
import org.springframework.web.servlet.DispatcherServlet;
import org.springframework.web.servlet.FrameworkServlet;
import org.springframework.web.servlet.support.AbstractAnnotationConfigDispatcherServletInitializer;
import ru.boq.vokmar.config.session.SessionEventListener;
import secyriry.service.EncodingFilter;
//import org.springframework.web.filter.CharacterEncodingFilter;
import javax.servlet.Filter;
import javax.servlet.FilterRegistration;
import javax.servlet.ServletContext;
public class SpringWebAppInitializer extends
AbstractAnnotationConfigDispatcherServletInitializer {
public static final String CHARACTER_ENCODING = "UTF-8";
public SpringWebAppInitializer (){
super();
}
@Override
protected Class<?>[] getRootConfigClasses() {
return new Class[] {WebSecurityConfig.class, DaraServisConfig.class };
//return null;
}
@Override
protected Class<?>[] getServletConfigClasses() {
return new Class[] {ASdf.class};
}
@Override
protected String[] getServletMappings() {
return new String[] { "/" };
}
@Override
protected FrameworkServlet createDispatcherServlet(WebApplicationContext servletAppContext){
DispatcherServlet dispatcher = (DispatcherServlet) super.createDispatcherServlet(servletAppContext);
dispatcher.setThrowExceptionIfNoHandlerFound(true);
return dispatcher;
}
@Override
protected void registerDispatcherServlet(ServletContext servletContext) {
super.registerDispatcherServlet(servletContext);
servletContext.addListener(new SessionEventListener());
}
}
package ru.boq.vokmar.config;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.ComponentScan;
import org.springframework.context.annotation.Configuration;
import org.springframework.http.HttpMethod;
import org.springframework.security.authentication.AuthenticationProvider;
import org.springframework.security.config.annotation.authentication.builders.AuthenticationManagerBuilder;
import org.springframework.security.config.annotation.method.configuration.EnableGlobalMethodSecurity;
import org.springframework.security.config.annotation.web.builders.HttpSecurity;
import org.springframework.security.config.annotation.web.builders.WebSecurity;
import org.springframework.security.config.annotation.web.configuration.EnableWebSecurity;
import org.springframework.security.config.annotation.web.configuration.WebSecurityConfigurerAdapter;
import org.springframework.security.core.session.SessionRegistry;
import org.springframework.security.core.session.SessionRegistryImpl;
import org.springframework.security.crypto.bcrypt.BCryptPasswordEncoder;
import org.springframework.security.crypto.password.PasswordEncoder;
import org.springframework.security.web.AuthenticationEntryPoint;
import org.springframework.security.web.access.AccessDeniedHandler;
import org.springframework.security.web.access.channel.ChannelProcessingFilter;
import org.springframework.security.web.authentication.AuthenticationFailureHandler;
import org.springframework.security.web.authentication.AuthenticationSuccessHandler;
import org.springframework.security.web.authentication.SimpleUrlAuthenticationFailureHandler;
import org.springframework.security.web.authentication.UsernamePasswordAuthenticationFilter;
import org.springframework.security.web.authentication.www.BasicAuthenticationEntryPoint;
import org.springframework.security.web.util.matcher.AntPathRequestMatcher;
import secyriry.authentication.CustomAuthencationProvider;
import secyriry.authentication.VokmarAuthenticationSuccessHandler;
import secyriry.authentication.filter.CustomAuthenticationFailureHandler;
import secyriry.authentication.loginpassworld.*;
import secyriry.service.EncodingFilter;
import secyriry.service.UserService;
import javax.servlet.http.HttpServletResponse;
@Configuration
@EnableWebSecurity
@ComponentScan(basePackages = {"secyriry"})
@EnableGlobalMethodSecurity(prePostEnabled = true)
public class WebSecurityConfig extends WebSecurityConfigurerAdapter {
@Autowired
private CustomUserDetailsService userDetailsService;
@Autowired(required=true)
private UserService userServices;
@Autowired
private CustomAuthencationProvider cap;
public WebSecurityConfig() {
super();
}
@Bean
public BCryptPasswordEncoder bCryptPasswordEncoder() {
return new BCryptPasswordEncoder();
}
@Override
public void configure(WebSecurity web)throws Exception {
//web.ignoring().antMatchers(HttpMethod.GET, "/ajax");
}
@Override
protected void configure(final HttpSecurity http) throws Exception {
// http.addFilterBefore(authenticationFilter(), UsernamePasswordAuthenticationFilter.class)
//
// .exceptionHandling().accessDeniedHandler(accessDeniedHandler())
// .and()
// .exceptionHandling().authenticationEntryPoint(new CustomHttp403ForbiddenEntryPoint());
// Разрешение загрузки ресурсов
http
//.addFilterBefore(authenticationFilter(), UsernamePasswordAuthenticationFilter.class)
//.authorizeRequests().antMatchers("/resources/**", "/css/**", "/js/**", "/images/**").permitAll()
//.and()
.authorizeRequests()
.antMatchers("/admin/**").hasRole("ADMIN")
.antMatchers("/ok/**").hasRole("USER")
.antMatchers("/*").permitAll()
.antMatchers("/resources/**", "/css/**", "/js/**", "/images/**").permitAll()
.and()
.addFilterBefore(authenticationFilter(), UsernamePasswordAuthenticationFilter.class)
.exceptionHandling().accessDeniedHandler(accessDeniedHandler())
.and()
.exceptionHandling().authenticationEntryPoint(new CustomHttp403ForbiddenEntryPoint())
.and()
.logout().deleteCookies("JSESSIONID")
.and().logout().invalidateHttpSession(true)
.and().logout().logoutSuccessUrl("/").permitAll()
.and().logout().logoutRequestMatcher(new AntPathRequestMatcher("/logout"))// Выход для ссылки
//.and().exceptionHandling().accessDeniedPage("/login.html")
.and()
.sessionManagement()
.invalidSessionUrl("/")
.maximumSessions(1)
.maxSessionsPreventsLogin(true)
.sessionRegistry(sessionRegistry());
// The usual stuff
}
@Bean
public AccessDeniedHandler accessDeniedHandler(){
return new CustomAccessDeniedHandler();
}
@Bean
public AuthenticationEntryPoint authenticationEntryPoint(){
BasicAuthenticationEntryPoint entryPoint =
new BasicAuthenticationEntryPoint();
entryPoint.setRealmName("admin realm");
return entryPoint;
}
@Override
protected void configure(final AuthenticationManagerBuilder auth) throws Exception {
//auth.userDetailsService(userServices).passwordEncoder(bCryptPasswordEncoder()); - вход стандартный
//auth.authenticationProvider(cap); //Собственный провайдер аудентификации
auth.authenticationProvider(authProvider()); // Собственный провайдер
}
@Autowired
public void configureGlobal(AuthenticationManagerBuilder auth) throws Exception {
auth.authenticationProvider(authProvider());
}
public PasswordEncoder passwordEncoder() {
return new BCryptPasswordEncoder();
}
public AuthenticationProvider authProvider() {
CustomUserDetailsAuthenticationProvider provider
= new CustomUserDetailsAuthenticationProvider(passwordEncoder(), userDetailsService);
return provider;
}
// Фильр шибки - не запустился
@Bean
public AuthenticationFailureHandler customAuthenticationFailureHandler() {
return new CustomAuthenticationFailureHandler();
}
@Bean
public AuthenticationSuccessHandler myAuthenticationSuccessHandler(){
return new VokmarAuthenticationSuccessHandler();
}
@Bean
public SessionRegistry sessionRegistry() {
return new SessionRegistryImpl();
}
@Bean
public CustomAuthenticationFilte authenticationFilter() throws Exception {
CustomAuthenticationFilte filter = new CustomAuthenticationFilte();
filter.setAuthenticationFailureHandler(customAuthenticationFailureHandler());
filter.setAuthenticationSuccessHandler(myAuthenticationSuccessHandler());
filter.setRequiresAuthenticationRequestMatcher(new AntPathRequestMatcher("/login.html", "POST"));
filter.setAuthenticationManager(authenticationManagerBean());
return filter;
}
public SimpleUrlAuthenticationFailureHandler failureHandler() {
return new SimpleUrlAuthenticationFailureHandler("/login?error=true");
}
}
package ru.boq.vokmar.controller;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.MediaType;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.validation.BindingResult;
import org.springframework.web.bind.annotation.*;
import secyriry.entity.User;
import secyriry.service.UserService;
import javax.servlet.http.HttpSession;
import javax.validation.Valid;
import java.util.List;
@Controller
public class HelloWorldController {
@Autowired
private UserService us;
@RequestMapping("/login.html")
public String log(HttpSession session) {
session.setAttribute("capha", "12356");
return "login";
}
@RequestMapping("/login-error.html")
public String loginError(Model model) {
model.addAttribute("loginError", true);
return "login";
}
@RequestMapping(value = "/", method = RequestMethod.GET)
public String index() {
return "index";
}
//@PreAuthorize("isAuthenticated()")
@PreAuthorize("hasRole('ADMIN')")
@RequestMapping(value = "/admin", method = RequestMethod.GET)
public String userAll(Model model){
List<User> aluset = us.allUsers();
model.addAttribute("user", aluset);
return "admin/admin";
}
@RequestMapping(value = "/accessdenied", method = RequestMethod.GET)
public String errorAccessdenied() {
return "error/accessdenied";
}
}
package secyriry.authentication;
import org.springframework.security.authentication.AuthenticationManager;
import org.springframework.security.core.Authentication;
import org.springframework.security.core.AuthenticationException;
import org.springframework.stereotype.Component;
/*
Использование:
1. при Ajax входе
*/
@Component
public class AuthenticationManagers implements AuthenticationManager {
@Override
public Authentication authenticate(Authentication authentication) throws AuthenticationException {
return authentication;
}
}
package secyriry.authentication;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.authentication.AuthenticationProvider;
import org.springframework.security.authentication.BadCredentialsException;
import org.springframework.security.authentication.UsernamePasswordAuthenticationToken;
import org.springframework.security.core.Authentication;
import org.springframework.security.core.AuthenticationException;
import org.springframework.security.core.GrantedAuthority;
import org.springframework.security.core.userdetails.UserDetails;
import org.springframework.security.core.userdetails.UsernameNotFoundException;
import org.springframework.security.crypto.bcrypt.BCryptPasswordEncoder;
import org.springframework.stereotype.Component;
import secyriry.entity.User;
import secyriry.repository.UserRepository;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpSession;
import java.util.List;
/*
Собственный провайдер аудентификации
*/
@Component
public class CustomAuthencationProvider implements AuthenticationProvider {
public CustomAuthencationProvider() {
super();
}
@Autowired
private HttpSession httpSession;
@Autowired
UserRepository userRepository;
@Autowired
BCryptPasswordEncoder bCryptPasswordEncoder;
@Autowired
AuthenticationManagers authenticationManager;
@Override
public Authentication authenticate(Authentication authentication) throws AuthenticationException {
String userName = authentication.getName(); // получаем из запроса
String password = authentication.getCredentials().toString();
//String capha = authenticationManager.authenticate(authentication).getPrincipal();
//String df = httpSession.getAttribute("capha").toString();
User myUser = userRepository.findByUsername(userName); // проверяем есть ли данный пользователь
if (myUser == null) {
throw new UsernameNotFoundException("Пользователя не существует");
}
if (!bCryptPasswordEncoder.matches(password, myUser.getPassword())) { // если ок true
throw new BadCredentialsException("Не верный пароль");
}
if (myUser.getUsername().equals(userName) && bCryptPasswordEncoder.matches(password, myUser.getPassword())) {
final UserDetails principal = new org.springframework.security.core.userdetails.User(userName, password, myUser.getAuthorities()); //введенные: имя, пароль, и полученные роли
final Authentication auth = new UsernamePasswordAuthenticationToken(principal, password, myUser.getAuthorities());
return auth;
}else {
throw new
BadCredentialsException("Ошибка ввода данных");
}
}
@Override
public boolean supports(Class<?> authentication) {
return authentication.equals(UsernamePasswordAuthenticationToken.class);
}
}
package secyriry.authentication.filter;
import com.fasterxml.jackson.databind.ObjectMapper;
import org.springframework.security.core.AuthenticationException;
import org.springframework.security.web.authentication.AuthenticationFailureHandler;
import org.springframework.stereotype.Component;
import javax.servlet.ServletException;
import javax.servlet.ServletOutputStream;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.util.Calendar;
import java.util.HashMap;
import java.util.Map;
@Component
public class CustomAuthenticationFailureHandler implements AuthenticationFailureHandler {
private ObjectMapper objectMapper = new ObjectMapper();
@Override
public void onAuthenticationFailure(HttpServletRequest request, HttpServletResponse response, AuthenticationException exception) throws IOException, ServletException {
Map<String, Object> data = new HashMap<>();
data.put(
"timestamp",
Calendar.getInstance().getTime());
data.put(
"exception",
exception.getMessage());
data.put(
"flag",
true);
response.getOutputStream().write(objectMapper.writeValueAsString(data).getBytes("UTF-8"));
}
}
package secyriry.authentication.loginpassworld;
import org.springframework.security.access.AccessDeniedException;
import org.springframework.security.web.access.AccessDeniedHandler;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
public class CustomAccessDeniedHandler implements AccessDeniedHandler {
@Override
public void handle(HttpServletRequest request, HttpServletResponse response, AccessDeniedException accessDeniedException) throws IOException, ServletException {
String url = request.getContextPath() + "/accessdenied";
response.sendRedirect(url);
}
}
package secyriry.authentication.loginpassworld;
import io.micrometer.core.instrument.util.IOUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Bean;
import org.springframework.security.authentication.AuthenticationServiceException;
import org.springframework.security.authentication.BadCredentialsException;
import org.springframework.security.authentication.InternalAuthenticationServiceException;
import org.springframework.security.authentication.UsernamePasswordAuthenticationToken;
import org.springframework.security.core.Authentication;
import org.springframework.security.core.AuthenticationException;
import org.springframework.security.web.authentication.UsernamePasswordAuthenticationFilter;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
public class CustomAuthenticationFilte extends UsernamePasswordAuthenticationFilter {
public static final String SPRING_SECURITY_FORM_CAPTCHA_KEY = "captha";
public CustomAuthenticationFilte() {
}
@Override
public Authentication attemptAuthentication(HttpServletRequest request, HttpServletResponse response) throws AuthenticationException {
if (!request.getMethod().equals("POST")) {
throw new AuthenticationServiceException("Authentication method not supported: "
+ request.getMethod());
}
CustomAuthenticationToken authRequest = getAuthRequest(request);
String cah = request.getSession().getAttribute("capha").toString();
String cah2 = authRequest.getCaptha();
if (cah.equals(cah2)){
}else{
throw new BadCredentialsException("Не верный проверочный код");
}
return this.getAuthenticationManager().authenticate(authRequest);
}
// if (!request.getMethod().equals("POST")) {
// throw new AuthenticationServiceException("Authentication method not supported: "
// + request.getMethod());
// }
//
// CustomAuthenticationToken authRequest = getAuthRequest(request);
// return this.getAuthenticationManager().authenticate(authRequest);
private CustomAuthenticationToken getAuthRequest(HttpServletRequest request) {
String username = obtainUsername(request);
String password = obtainPassword(request);
String captha = obtainCaptha(request);
return new CustomAuthenticationToken(username, password, captha);
//return new CustomAuthenticationToken(username, password);
}
private String obtainCaptha(HttpServletRequest request) {
return request.getParameter(SPRING_SECURITY_FORM_CAPTCHA_KEY);
}
}
package secyriry.authentication.loginpassworld;
import org.springframework.security.authentication.UsernamePasswordAuthenticationToken;
import org.springframework.security.core.GrantedAuthority;
import java.util.Collection;
public class CustomAuthenticationToken extends UsernamePasswordAuthenticationToken {
private String captha;
// public CustomAuthenticationToken(Object principal, Object credentials) { //String captha
// super(principal, credentials);
// // this.captha = captha;
// super.setAuthenticated(false);
// }
public CustomAuthenticationToken(Object principal, Object credentials,String captha) { //String captha
super(principal, credentials);
this.captha = captha;
super.setAuthenticated(false);
}
public CustomAuthenticationToken(Object principal, Object credentials, String captha, Collection<? extends GrantedAuthority> authorities) {
super(principal, credentials, authorities);
this.captha = captha;
super.setAuthenticated(false);
}
public String getCaptha() {
return this.captha;
}
}
package secyriry.authentication.loginpassworld;
import org.springframework.security.core.AuthenticationException;
import org.springframework.security.web.AuthenticationEntryPoint;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
public class CustomHttp403ForbiddenEntryPoint implements AuthenticationEntryPoint {
@Override
public void commence(HttpServletRequest request, HttpServletResponse response, AuthenticationException authException) throws IOException, ServletException {
String url = request.getContextPath() + "/login.html";
response.sendRedirect(url);
}
}
package secyriry.authentication.loginpassworld;
import org.springframework.security.authentication.BadCredentialsException;
import org.springframework.security.authentication.InternalAuthenticationServiceException;
import org.springframework.security.authentication.UsernamePasswordAuthenticationToken;
import org.springframework.security.authentication.dao.AbstractUserDetailsAuthenticationProvider;
import org.springframework.security.core.AuthenticationException;
import org.springframework.security.core.userdetails.UserDetails;
import org.springframework.security.core.userdetails.UsernameNotFoundException;
import org.springframework.security.crypto.password.PasswordEncoder;
import org.springframework.util.Assert;
public class CustomUserDetailsAuthenticationProvider extends AbstractUserDetailsAuthenticationProvider {
/**
* The plaintext password used to perform
* PasswordEncoder#matches(CharSequence, String)} on when the user is
* not found to avoid SEC-2056.
*/
private static final String USER_NOT_FOUND_PASSWORD = "userNotFoundPassword";
private PasswordEncoder passwordEncoder;
private CustomUserDetailsService userDetailsService;
/**
* The password used to perform
* {@link PasswordEncoder#matches(CharSequence, String)} on when the user is
* not found to avoid SEC-2056. This is necessary, because some
* {@link PasswordEncoder} implementations will short circuit if the password is not
* in a valid format.
*/
private String userNotFoundEncodedPassword;
public CustomUserDetailsAuthenticationProvider(PasswordEncoder passwordEncoder, CustomUserDetailsService userDetailsService) {
this.passwordEncoder = passwordEncoder;
this.userDetailsService = userDetailsService;
}
@Override
protected void additionalAuthenticationChecks(UserDetails userDetails, UsernamePasswordAuthenticationToken authentication)
throws AuthenticationException {
if (authentication.getCredentials() == null) {
logger.debug("Authentication failed: no credentials provided");
throw new BadCredentialsException(
messages.getMessage("AbstractUserDetailsAuthenticationProvider.badCredentials", "Bad credentials"));
}
String presentedPassword = authentication.getCredentials()
.toString();
if (!passwordEncoder.matches(presentedPassword, userDetails.getPassword())) {
logger.debug("Authentication failed: password does not match stored value");
throw new BadCredentialsException(
messages.getMessage("AbstractUserDetailsAuthenticationProvider.badCredentials", "Bad credentials"));
}
}
@Override
protected void doAfterPropertiesSet() throws Exception {
Assert.notNull(this.userDetailsService, "A UserDetailsService must be set");
this.userNotFoundEncodedPassword = this.passwordEncoder.encode(USER_NOT_FOUND_PASSWORD);
}
@Override
protected UserDetails retrieveUser(String username, UsernamePasswordAuthenticationToken authentication)
throws AuthenticationException {
CustomAuthenticationToken auth = (CustomAuthenticationToken) authentication;
if(auth instanceof UsernamePasswordAuthenticationToken){
auth= (CustomAuthenticationToken) authentication;
}
UserDetails loadedUser;
try {
loadedUser = this.userDetailsService.loadUserByUsernameAndDomain(auth.getPrincipal()
.toString(), auth.getCaptha());
} catch (UsernameNotFoundException notFound) {
if (authentication.getCredentials() != null) {
String presentedPassword = authentication.getCredentials()
.toString();
passwordEncoder.matches(presentedPassword, userNotFoundEncodedPassword);
}
throw notFound;
} catch (Exception repositoryProblem) {
throw new InternalAuthenticationServiceException(repositoryProblem.getMessage(), repositoryProblem);
}
if (loadedUser == null) {
throw new InternalAuthenticationServiceException("UserDetailsService returned null, "
+ "which is an interface contract violation");
}
return loadedUser;
}
}