Skip to content

Commit

Permalink
Merge pull request #6488 from JohnNiang/feat/login-logout-pages
Browse files Browse the repository at this point in the history
Add support for customizing login and logout pages
  • Loading branch information
ruibaby authored Sep 28, 2024
2 parents 56cb22a + 8547ffe commit 45a08bd
Show file tree
Hide file tree
Showing 107 changed files with 3,162 additions and 1,339 deletions.
15 changes: 15 additions & 0 deletions api/src/main/java/run/halo/app/core/extension/AuthProvider.java
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,15 @@ public static class AuthProviderSpec {
@Schema(requiredMode = REQUIRED, description = "Authentication url of the auth provider")
private String authenticationUrl;

private String method = "GET";

private boolean rememberMeSupport = false;

/**
* Auth type: form or oauth2.
*/
private AuthType authType;

private String bindingUrl;

private String unbindUrl;
Expand Down Expand Up @@ -77,4 +86,10 @@ public static class ConfigMapRef {
@Schema(requiredMode = REQUIRED, minLength = 1)
private String name;
}

public enum AuthType {
FORM,
OAUTH2,
;
}
}
8 changes: 7 additions & 1 deletion api/src/main/java/run/halo/app/extension/Unstructured.java
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
import com.fasterxml.jackson.databind.DeserializationContext;
import com.fasterxml.jackson.databind.JsonDeserializer;
import com.fasterxml.jackson.databind.JsonSerializer;
import com.fasterxml.jackson.databind.MapperFeature;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.fasterxml.jackson.databind.SerializerProvider;
import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
Expand Down Expand Up @@ -35,7 +36,12 @@
@SuppressWarnings("rawtypes")
public class Unstructured implements Extension {

public static final ObjectMapper OBJECT_MAPPER = Json.mapper();
@SuppressWarnings("deprecation")
public static final ObjectMapper OBJECT_MAPPER = Json.mapper()
// We don't want to change the default mapper
// so we copy a new one and configure it
.copy()
.enable(MapperFeature.ACCEPT_CASE_INSENSITIVE_ENUMS);

private final Map data;

Expand Down
18 changes: 18 additions & 0 deletions api/src/main/java/run/halo/app/infra/ExternalLinkProcessor.java
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
package run.halo.app.infra;

import java.net.URI;
import org.springframework.http.HttpRequest;
import reactor.core.publisher.Mono;

/**
* {@link ExternalLinkProcessor} to process an in-site link to an external link.
*
Expand All @@ -17,4 +21,18 @@ public interface ExternalLinkProcessor {
* @return processed link or original link
*/
String processLink(String link);

/**
* Process the URI to an external URL.
* <p>
* If the URI is an in-site link, then process it to an external link with
* {@link ExternalUrlSupplier#getRaw()} or {@link ExternalUrlSupplier#getURL(HttpRequest)},
* otherwise return the original URI.
* </p>
*
* @param uri uri to process
* @return processed URI or original URI
*/
Mono<URI> processLink(URI uri);

}
4 changes: 2 additions & 2 deletions api/src/main/java/run/halo/app/infra/SystemSetting.java
Original file line number Diff line number Diff line change
Expand Up @@ -67,8 +67,8 @@ public static class Basic {
@Data
public static class User {
public static final String GROUP = "user";
Boolean allowRegistration;
Boolean mustVerifyEmailOnRegistration;
boolean allowRegistration;
boolean mustVerifyEmailOnRegistration;
String defaultRole;
String avatarPolicy;
}
Expand Down
6 changes: 5 additions & 1 deletion application/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,10 @@ dependencies {
testImplementation 'org.springframework.boot:spring-boot-starter-test'
testImplementation 'org.springframework.security:spring-security-test'
testImplementation 'io.projectreactor:reactor-test'

// webjars
runtimeOnly 'org.webjars.npm:jsencrypt:3.3.2'
runtimeOnly 'org.webjars.npm:normalize.css:8.0.1'
}

tasks.register('createChecksums', Checksum) {
Expand Down Expand Up @@ -164,4 +168,4 @@ tasks.named('generateOpenApiDocs') {
outputs.upToDateWhen {
false
}
}
}

This file was deleted.

Loading

0 comments on commit 45a08bd

Please sign in to comment.