-
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 branch 'SHIBUI-906' of bitbucket.org:unicon/shib-idp-ui into SH…
…IBUI-906
- Loading branch information
Showing
19 changed files
with
306 additions
and
52 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
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
24 changes: 24 additions & 0 deletions
24
...leth/admin/ui/jsonschema/RelyingPartyOverridesJsonSchemaValidatingControllerAdvice.groovy
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,24 @@ | ||
package edu.internet2.tier.shibboleth.admin.ui.jsonschema | ||
|
||
import org.springframework.core.MethodParameter | ||
import org.springframework.http.converter.HttpMessageConverter | ||
import org.springframework.web.bind.annotation.ControllerAdvice | ||
import org.springframework.web.servlet.mvc.method.annotation.RequestBodyAdviceAdapter | ||
|
||
import java.lang.reflect.Type | ||
|
||
/** | ||
* Controller advice implementation for validating relying party overrides payload coming from UI layer | ||
* against pre-defined JSON schema. | ||
* | ||
* @author Dmitriy Kopylenko | ||
*/ | ||
@ControllerAdvice | ||
class RelyingPartyOverridesJsonSchemaValidatingControllerAdvice extends RequestBodyAdviceAdapter { | ||
|
||
@Override | ||
boolean supports(MethodParameter methodParameter, Type targetType, Class<? extends HttpMessageConverter<?>> converterType) { | ||
def cls = targetType.typeName | ||
print('cx') | ||
} | ||
} |
24 changes: 24 additions & 0 deletions
24
...2/tier/shibboleth/admin/ui/configuration/JsonSchemaValidationComponentsConfiguration.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,24 @@ | ||
package edu.internet2.tier.shibboleth.admin.ui.configuration; | ||
|
||
import edu.internet2.tier.shibboleth.admin.ui.jsonschema.MetadataSourcesJsonSchemaResourceLocation; | ||
import edu.internet2.tier.shibboleth.admin.ui.jsonschema.RelyingPartyOverridesJsonSchemaValidatingControllerAdvice; | ||
import org.springframework.context.annotation.Bean; | ||
import org.springframework.context.annotation.Configuration; | ||
import org.springframework.core.io.ResourceLoader; | ||
|
||
/** | ||
* @author Dmitriy Kopylenko | ||
*/ | ||
@Configuration | ||
public class JsonSchemaValidationComponentsConfiguration { | ||
|
||
@Bean | ||
public MetadataSourcesJsonSchemaResourceLocation metadataSourcesJsonSchemaResourceLocation(ResourceLoader resourceLoader) { | ||
return new MetadataSourcesJsonSchemaResourceLocation(resourceLoader); | ||
} | ||
|
||
@Bean | ||
public RelyingPartyOverridesJsonSchemaValidatingControllerAdvice relyingPartyOverridesJsonSchemaValidatingControllerAdvice() { | ||
return new RelyingPartyOverridesJsonSchemaValidatingControllerAdvice(); | ||
} | ||
} |
20 changes: 20 additions & 0 deletions
20
...du/internet2/tier/shibboleth/admin/ui/jsonschema/JsonSchemaValidationFailedException.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,20 @@ | ||
package edu.internet2.tier.shibboleth.admin.ui.jsonschema; | ||
|
||
import lombok.Getter; | ||
import lombok.RequiredArgsConstructor; | ||
|
||
import java.util.List; | ||
|
||
/** | ||
* Indicates JSON schema validation failure. Encapsulates a list of error messages produced by JSON schema validator | ||
* component. | ||
* | ||
* @author Dmitriy Kopylenko | ||
*/ | ||
@RequiredArgsConstructor | ||
@Getter | ||
public class JsonSchemaValidationFailedException extends RuntimeException { | ||
|
||
private final List<String> errors; | ||
|
||
} |
58 changes: 58 additions & 0 deletions
58
...ernet2/tier/shibboleth/admin/ui/jsonschema/MetadataSourcesJsonSchemaResourceLocation.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,58 @@ | ||
package edu.internet2.tier.shibboleth.admin.ui.jsonschema; | ||
|
||
import org.springframework.beans.factory.BeanCreationException; | ||
import org.springframework.beans.factory.annotation.Autowired; | ||
import org.springframework.boot.context.properties.ConfigurationProperties; | ||
import org.springframework.boot.context.properties.EnableConfigurationProperties; | ||
import org.springframework.core.io.ResourceLoader; | ||
import org.springframework.stereotype.Component; | ||
|
||
import javax.annotation.PostConstruct; | ||
import java.io.IOException; | ||
import java.net.URI; | ||
import java.net.URISyntaxException; | ||
import java.net.URL; | ||
|
||
/** | ||
* Encapsulates metadata sources JSON schema location. | ||
* | ||
* @author Dmitriy Kopylenko | ||
*/ | ||
@ConfigurationProperties("shibui") | ||
public class MetadataSourcesJsonSchemaResourceLocation { | ||
|
||
//Configured via @ConfigurationProperties with 'shibui.metadata-sources-ui-schema-location' property and default | ||
//value set here if that property is not explicitly set in application.properties | ||
private String metadataSourcesUiSchemaLocation = "classpath:metadata-sources-ui-schema.json"; | ||
|
||
private URL jsonSchemaUrl; | ||
|
||
ResourceLoader resourceLoader; | ||
|
||
public MetadataSourcesJsonSchemaResourceLocation(ResourceLoader resourceLoader) { | ||
this.resourceLoader = resourceLoader; | ||
} | ||
|
||
public URL getUrl() { | ||
return this.jsonSchemaUrl; | ||
} | ||
|
||
public URI getUri() { | ||
try { | ||
return this.jsonSchemaUrl.toURI(); | ||
} | ||
catch (URISyntaxException ex) { | ||
throw new RuntimeException(ex); | ||
} | ||
} | ||
|
||
@PostConstruct | ||
public void init() { | ||
try { | ||
this.jsonSchemaUrl = this.resourceLoader.getResource(this.metadataSourcesUiSchemaLocation).getURL(); | ||
} | ||
catch (IOException ex) { | ||
throw new BeanCreationException(ex.getMessage(), ex); | ||
} | ||
} | ||
} |
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
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,45 @@ | ||
# Database configuration | ||
|
||
The Shibboleth UI application uses Spring Boot and Spring JPA for database configuration. Out of the box, it ships with | ||
JDBC drivers for H2, MariaDB and Postgres. | ||
|
||
By default, it will use an in-memory H2 database. To change which database is used, one should make changes to the | ||
`applications.properties` or `application.yml` file as appropriate. For further information, refer to the appropriate | ||
JDBC driver documentation. | ||
|
||
```properties | ||
# Database Credentials | ||
spring.datasource.username=shibui | ||
spring.datasource.password=shibui | ||
|
||
# Database Configuration H2 | ||
spring.datasource.url=jdbc:h2:mem:shibui;DB_CLOSE_DELAY=-1;DB_CLOSE_ON_EXIT=FALSE | ||
spring.datasource.platform=h2 | ||
spring.datasource.driverClassName=org.h2.Driver | ||
spring.jpa.database-platform=org.hibernate.dialect.H2Dialect | ||
spring.h2.console.enabled=true | ||
|
||
|
||
# Database Configuration PostgreSQL | ||
#spring.datasource.url=jdbc:postgresql://localhost:5432/shibui | ||
#spring.datasource.driverClassName=org.postgresql.Driver | ||
#spring.jpa.properties.hibernate.dialect=org.hibernate.dialect.PostgreSQLDialect | ||
|
||
#Maria/MySQL DB | ||
#spring.datasource.url=jdbc:mariadb://localhost:3306/shibui | ||
#spring.datasource.driverClassName=org.mariadb.jdbc.Driver | ||
#spring.jpa.properties.hibernate.dialect=org.hibernate.dialect.MariaDBDialect | ||
|
||
# Liquibase properties | ||
spring.liquibase.enabled=false | ||
#spring.liquibase.change-log=classpath:edu/internet2/tier/shibboleth/admin/ui/database/masterchangelog.xml | ||
|
||
# Hibernate properties | ||
# for production never ever use create, create-drop. It's BEST to use validate | ||
spring.jpa.hibernate.ddl-auto=update | ||
spring.jpa.hibernate.naming.implicit-strategy=org.hibernate.boot.model.naming.ImplicitNamingStrategyJpaCompliantImpl | ||
spring.jpa.show-sql=false | ||
spring.jpa.properties.hibernate.format_sql=false | ||
|
||
spring.jpa.hibernate.use-new-id-generator-mappings=true | ||
``` |
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,55 @@ | ||
# Getting Started | ||
|
||
## Requirements | ||
|
||
* Java 8 (note that ONLY Java 8 is supported at this time) | ||
|
||
## Running | ||
|
||
There are currently 2 ways to run the application: | ||
|
||
1. As an executable | ||
1. deployed in a Java Servlet 3.0 container | ||
|
||
Note that some features require encoded slashes in the URL. In tomcat (which is embedded in the war), this can be | ||
allowed with: | ||
|
||
``` | ||
-Dorg.apache.tomcat.util.buf.UDecoder.ALLOW_ENCODED_SLASH=true | ||
``` | ||
|
||
In Apache HTTPD, you'll need something like: | ||
|
||
``` | ||
<VirtualHost *:80> | ||
AllowEncodedSlashes NoDecode | ||
ServerName shibui.unicon.net | ||
ProxyPass / http://localhost:8080/ nocanon | ||
ProxyPassReverse / http://localhost:8080/ | ||
</VirtualHost> | ||
``` | ||
|
||
Note the `AllowEncodedSlashes NoDecode`. | ||
|
||
### Running as an executable | ||
|
||
`java -jar shibui.war` | ||
|
||
For complete information on overriding default configuration, see [https://docs.spring.io/spring-boot/docs/current/reference/html/boot-features-external-config.html]. | ||
|
||
### Deploying as a WAR | ||
|
||
The application can be deployed as a WAR file in a Java Servlet 3.0 container. Currently, the application must be run in the root context. | ||
|
||
To override default configuration, see [https://docs.spring.io/spring-boot/docs/current/reference/html/boot-features-external-config.html]. | ||
The easiest way to do this in a servlet container is through the use of system properties | ||
|
||
## Authentication | ||
|
||
Currently, the application is wired with very simple authentication. A password for the user `user` | ||
can be set with the `shibui.default-password` property. If none is set, a default password | ||
will be generated and logged: | ||
|
||
``` | ||
Using default security password: a3d9ab96-9c63-414f-b199-26fcf59e1ffa | ||
``` |
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,6 @@ | ||
# Shibboleth UI | ||
|
||
* [DATABASE] | ||
* [CUSTOMIZATIONS] | ||
* [INTERNATIONALIZATION] | ||
* [DATABASE] |
Oops, something went wrong.