move jaas to core security module.

This commit is contained in:
eelhazati 2020-02-29 16:46:05 +01:00
parent a655119424
commit 1bfac7ea53
17 changed files with 14 additions and 97 deletions

View File

@ -16,4 +16,5 @@ This module contains articles about core Java Security
- [An Introduction to Java SASL](https://www.baeldung.com/java-sasl)
- [A Guide to Java GSS API](https://www.baeldung.com/java-gss)
- [Intro to the Java SecurityManager](https://www.baeldung.com/java-security-manager)
- [Guide To The Java Authentication And Authorization Service (JAAS)](https://www.baeldung.com/java-security-jaas)

View File

@ -1,4 +1,4 @@
package com.baeldung.security.jaas.app;
package com.baeldung.jaas;
import javax.security.auth.callback.*;
import java.io.Console;

View File

@ -1,4 +1,4 @@
package com.baeldung.security.jaas.app;
package com.baeldung.jaas;
import javax.security.auth.Subject;
import javax.security.auth.login.LoginException;

View File

@ -1,4 +1,4 @@
package com.baeldung.security.jaas.app;
package com.baeldung.jaas;
import javax.security.auth.Subject;
import javax.security.auth.login.LoginException;

View File

@ -1,4 +1,4 @@
package com.baeldung.security.jaas.app;
package com.baeldung.jaas;
import javax.security.auth.Subject;
import javax.security.auth.login.LoginContext;

View File

@ -1,4 +1,4 @@
package com.baeldung.security.jaas.app;
package com.baeldung.jaas;
import java.security.PrivilegedAction;

View File

@ -1,4 +1,4 @@
package com.baeldung.security.jaas.app;
package com.baeldung.jaas;
import java.security.BasicPermission;

View File

@ -1,4 +1,4 @@
package com.baeldung.security.jaas.authentication;
package com.baeldung.jaas.loginmodule;
import com.sun.security.auth.UserPrincipal;

View File

@ -0,0 +1,3 @@
jaasApplication {
com.baeldung.jaas.loginmodule.InMemoryLoginModule required debug=true;
};

View File

@ -1,14 +1,14 @@
grant codebase "file:./jaas-app/target/jaas-app.jar" {
grant codebase "file:./target/core-java-security-0.1.0-SNAPSHOT.jar" {
permission javax.security.auth.AuthPermission "createLoginContext.jaasApplication";
permission javax.security.auth.AuthPermission "doAsPrivileged";
permission java.lang.RuntimePermission "readFileDescriptor";
permission java.lang.RuntimePermission "writeFileDescriptor";
};
grant codebase "file:./jaas-login-module/target/jaas-login-module.jar" {
grant codebase "file:./target/core-java-security-0.1.0-SNAPSHOT.jar" {
permission javax.security.auth.AuthPermission "modifyPrincipals";
};
grant principal com.sun.security.auth.UserPrincipal "testuser" {
permission com.baeldung.security.jaas.app.ResourcePermission "test_resource";
permission com.baeldung.jaas.ResourcePermission "test_resource";
};

View File

@ -636,7 +636,6 @@
<module>webrtc</module>
<module>wildfly</module>
<module>quarkus-extension</module>
<module>security-jaas</module>
</modules>
</profile>

View File

@ -1,40 +0,0 @@
<?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>
<parent>
<groupId>com.baeldung.security.jaas</groupId>
<artifactId>security-jaas</artifactId>
<version>1.0-SNAPSHOT</version>
</parent>
<artifactId>jaas-app</artifactId>
<build>
<plugins>
<plugin>
<artifactId>maven-jar-plugin</artifactId>
<version>3.1.2</version>
<configuration>
<archive>
<manifest>
<addClasspath>true</addClasspath>
<mainClass>com.baeldung.security.jaas.JaasApplication</mainClass>
</manifest>
</archive>
</configuration>
</plugin>
</plugins>
</build>
<dependencies>
<dependency>
<groupId>com.baeldung.security.jaas</groupId>
<artifactId>jaas-login-module</artifactId>
<version>1.0-SNAPSHOT</version>
<scope>provided</scope>
</dependency>
</dependencies>
</project>

View File

@ -1,14 +0,0 @@
<?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>
<parent>
<groupId>com.baeldung.security.jaas</groupId>
<artifactId>security-jaas</artifactId>
<version>1.0-SNAPSHOT</version>
</parent>
<artifactId>jaas-login-module</artifactId>
</project>

View File

@ -1,3 +0,0 @@
jaasApplication {
com.baeldung.security.jaas.authentication.InMemoryLoginModule required debug=true;
};

View File

@ -1,27 +0,0 @@
<?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>com.baeldung.security.jaas</groupId>
<artifactId>security-jaas</artifactId>
<version>1.0-SNAPSHOT</version>
<packaging>pom</packaging>
<properties>
<maven.compiler.source>1.8</maven.compiler.source>
<maven.compiler.target>1.8</maven.compiler.target>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>
<modules>
<module>jaas-app</module>
<module>jaas-login-module</module>
</modules>
<build>
<finalName>${project.artifactId}</finalName>
</build>
</project>

View File

@ -1 +0,0 @@
java -Djava.security.auth.login.config=jaas.login.config -classpath jaas-app/target/jaas-app.jar;jaas-login-module/target/jaas-login-module.jar com.baeldung.security.jaas.app.JaasAuthentication

View File

@ -1 +0,0 @@
java -Djava.security.manager -Djava.security.policy=jaas.policy -Djava.security.auth.login.config=jaas.login.config -classpath %JAVA_HOME%\lib;jaas-app/target/jaas-app.jar;jaas-login-module/target/jaas-login-module.jar com.baeldung.security.jaas.app.JaasAuthorization