-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #3 from xdev-software/develop
Release
- Loading branch information
Showing
43 changed files
with
2,814 additions
and
43 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
# 1.0.0 | ||
<i>Initial release</i> | ||
* All methods and functionality are designed to be overwritable (at least protected) | ||
* The library consists of 2 main parts: | ||
* ``extendable`` → Includes the bare minimum to make the Spring components extendable | ||
* ``advanced`` → Contains components made on top of ``extendable`` with many customization options; Additionally: | ||
* Updated Bootstrap to version 5.3+ | ||
* Improved SSO (OAuth2 / SAML2) UI |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
oidc-user-config.json |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
## Development Infrastructure | ||
|
||
The infrastructure contains the following: | ||
* [Open ID Connect Mock Server](https://github.com/Soluto/oidc-server-mock) - for login in | ||
* Available at http://localhost:4011 | ||
|
||
### Setup | ||
* Requires Docker | ||
|
||
#### OIDC | ||
* Create ``oidc-user-config.json`` from [``oidc-user-config.json.template``](./oidc-user-config.json.template) | ||
* File should not be tracked in Git | ||
* Fill in your login details like mail, name, password | ||
|
||
|
||
### Usage | ||
Note: Commands are all executed inside a shell/CMD in the current folder. ([Tip for windows users](https://stackoverflow.com/a/40146208)) | ||
|
||
| Use case | What to do? | | ||
| --- | --- | | ||
| Starting the infrastructure | ``docker compose up`` | | ||
| Stopping (and removing) the infrastructure | ``docker compose down`` | | ||
| (Re)Building the infrastructure<br/>e.g. after changes to the Dockerfiles | ``docker compose build --pull`` | | ||
|
||
See also ``docker compose --help`` | ||
|
||
### Additional notes | ||
⚠ The containers don't automatically restart after a PC restart! | ||
|
||
⚠ After a PC restart the infrastructure is still present but it's stopped.<br/> | ||
In this case you have 2 options: | ||
* start the existing infrastructure again (``docker compose up``) or | ||
* do a clean start by first removing (``docker compose down``) and then starting the infrastructure |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,69 @@ | ||
version: "3" | ||
|
||
services: | ||
# Docs: https://docs.duendesoftware.com | ||
oidc-server-mock: | ||
container_name: oidc-server-mock | ||
image: ghcr.io/soluto/oidc-server-mock:0.9.0 | ||
environment: | ||
ASPNETCORE_ENVIRONMENT: Development | ||
SERVER_OPTIONS_INLINE: | | ||
{ | ||
"AccessTokenJwtType": "JWT", | ||
"Discovery": { | ||
"ShowKeySet": true | ||
}, | ||
"Authentication": { | ||
"CookieSameSiteMode": "Lax", | ||
"CheckSessionCookieSameSiteMode": "Lax" | ||
} | ||
} | ||
LOGIN_OPTIONS_INLINE: | | ||
{ | ||
"AllowRememberLogin": false | ||
} | ||
LOGOUT_OPTIONS_INLINE: | | ||
{ | ||
"AutomaticRedirectAfterSignOut": true | ||
} | ||
USERS_CONFIGURATION_PATH: /tmp/config/oidc-user-config.json | ||
CLIENTS_CONFIGURATION_INLINE: | | ||
[ | ||
{ | ||
"ClientId": "client-id", | ||
"ClientSecrets": [ | ||
"client-secret" | ||
], | ||
"Description": "TestClient", | ||
"AllowedGrantTypes": [ | ||
"authorization_code", | ||
"refresh_token" | ||
], | ||
"RedirectUris": [ | ||
"*" | ||
], | ||
"AllowedScopes": [ | ||
"openid", | ||
"profile", | ||
"email", | ||
"offline_access" | ||
], | ||
"AlwaysIncludeUserClaimsInIdToken": true, | ||
"AllowOfflineAccess": true, | ||
"RequirePkce": false | ||
} | ||
] | ||
ASPNET_SERVICES_OPTIONS_INLINE: | | ||
{ | ||
"ForwardedHeadersOptions": { | ||
"ForwardedHeaders" : "All" | ||
} | ||
} | ||
volumes: | ||
- ./oidc-user-config.json:/tmp/config/oidc-user-config.json:ro | ||
ports: | ||
- '4011:8080' | ||
deploy: | ||
resources: | ||
limits: | ||
memory: 512m |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
[ | ||
{ | ||
"SubjectId":"1", | ||
"Username":"[email protected]", | ||
"Password":"pwd", | ||
"Claims": [ | ||
{ | ||
"Type": "name", | ||
"Value": "Your name", | ||
"ValueType": "string" | ||
}, | ||
{ | ||
"Type": "email", | ||
"Value": "[email protected]", | ||
"ValueType": "string" | ||
} | ||
] | ||
} | ||
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
# Demo | ||
|
||
* Start the [development infrastructure](../dev_infra/) | ||
* Run the application | ||
* Open ``http://localhost:8080`` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
15 changes: 15 additions & 0 deletions
15
spring-security-advanced-authentication-ui-demo/src/main/java/software/xdev/Application.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
package software.xdev; | ||
|
||
import org.springframework.boot.SpringApplication; | ||
import org.springframework.boot.autoconfigure.SpringBootApplication; | ||
|
||
|
||
@SuppressWarnings("checkstyle:HideUtilityClassConstructor") | ||
@SpringBootApplication | ||
public class Application | ||
{ | ||
public static void main(final String[] args) | ||
{ | ||
SpringApplication.run(Application.class, args); | ||
} | ||
} |
34 changes: 34 additions & 0 deletions
34
...vanced-authentication-ui-demo/src/main/java/software/xdev/controllers/RootController.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
package software.xdev.controllers; | ||
|
||
import org.springframework.security.core.context.SecurityContextHolder; | ||
import org.springframework.security.oauth2.core.oidc.user.DefaultOidcUser; | ||
import org.springframework.web.bind.annotation.GetMapping; | ||
import org.springframework.web.bind.annotation.RequestMapping; | ||
import org.springframework.web.bind.annotation.RestController; | ||
|
||
|
||
@RestController | ||
@RequestMapping("/") | ||
public class RootController | ||
{ | ||
@GetMapping | ||
public Result respond() | ||
{ | ||
if(SecurityContextHolder.getContext() | ||
.getAuthentication() | ||
.getPrincipal() instanceof final DefaultOidcUser oidcUser) | ||
{ | ||
return new Result(oidcUser.getFullName(), oidcUser.getEmail(), "/logout"); | ||
} | ||
return null; | ||
} | ||
|
||
public record Result( | ||
String name, | ||
String email, | ||
String logoutUrl | ||
) | ||
{ | ||
|
||
} | ||
} |
Oops, something went wrong.