Merge pull request #19 from bsinno/fix_overwrite_anonymous_property
+1, merged
This commit is contained in:
@@ -10,8 +10,9 @@ package org.eclipse.hawkbit.security;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import org.springframework.beans.factory.annotation.Value;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.boot.context.properties.ConfigurationProperties;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
/**
|
||||
* The common properties for security.
|
||||
@@ -22,47 +23,108 @@ import org.springframework.boot.context.properties.ConfigurationProperties;
|
||||
@ConfigurationProperties
|
||||
public class SecurityProperties {
|
||||
|
||||
@Value("${hawkbit.server.controller.security.rp.cnHeader:X-Ssl-Client-Cn}")
|
||||
private String rpCnHeader;
|
||||
/**
|
||||
* Inner class for reverse proxy configuration.
|
||||
*/
|
||||
@Component
|
||||
@ConfigurationProperties("hawkbit.server.controller.security.rp")
|
||||
public static class RpProperties {
|
||||
private String cnHeader = "X-Ssl-Client-Cn";
|
||||
private String sslIssuerHashHeader = "X-Ssl-Issuer-Hash-%d";
|
||||
private List<String> trustedIPs;
|
||||
|
||||
@Value("${hawkbit.server.controller.security.rp.sslIssuerHashHeader:X-Ssl-Issuer-Hash-%d}")
|
||||
private String rpSslIssuerHashHeader;
|
||||
/**
|
||||
* @return the cnHeader
|
||||
*/
|
||||
public String getCnHeader() {
|
||||
return cnHeader;
|
||||
}
|
||||
|
||||
@Value("${hawkbit.server.controller.security.rp.trustedIPs:#{null}}")
|
||||
private List<String> rpTrustedIPs;
|
||||
/**
|
||||
* @param cnHeader
|
||||
* the cnHeader to set
|
||||
*/
|
||||
public void setCnHeader(final String cnHeader) {
|
||||
this.cnHeader = cnHeader;
|
||||
}
|
||||
|
||||
@Value("${hawkbit.server.controller.security.authentication.anonymous.enabled:false}")
|
||||
private Boolean anonymousEnabled;
|
||||
/**
|
||||
* @return the sslIssuerHashHeader
|
||||
*/
|
||||
public String getSslIssuerHashHeader() {
|
||||
return sslIssuerHashHeader;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param sslIssuerHashHeader
|
||||
* the sslIssuerHashHeader to set
|
||||
*/
|
||||
public void setSslIssuerHashHeader(final String sslIssuerHashHeader) {
|
||||
this.sslIssuerHashHeader = sslIssuerHashHeader;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the trustedIPs
|
||||
*/
|
||||
public List<String> getTrustedIPs() {
|
||||
return trustedIPs;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param trustedIPs
|
||||
* the trustedIPs to set
|
||||
*/
|
||||
public void setTrustedIPs(final List<String> trustedIPs) {
|
||||
this.trustedIPs = trustedIPs;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Inner class for anonymous enable configuration.
|
||||
*/
|
||||
@Component
|
||||
@ConfigurationProperties("hawkbit.server.controller.security.authentication.anonymous")
|
||||
public static class AnoymousAuthenticationProperties {
|
||||
private Boolean enabled = Boolean.FALSE;
|
||||
|
||||
/**
|
||||
* @param enabled
|
||||
* the enabled to set
|
||||
*/
|
||||
public void setEnabled(final Boolean enabled) {
|
||||
this.enabled = enabled;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the enabled
|
||||
*/
|
||||
public Boolean getEnabled() {
|
||||
return enabled;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@Autowired
|
||||
private RpProperties rppProperties;
|
||||
|
||||
@Autowired
|
||||
private AnoymousAuthenticationProperties authenticationsProperties;
|
||||
|
||||
public String getRpCnHeader() {
|
||||
return rpCnHeader;
|
||||
return rppProperties.getCnHeader();
|
||||
}
|
||||
|
||||
public String getRpSslIssuerHashHeader() {
|
||||
return rpSslIssuerHashHeader;
|
||||
return rppProperties.getSslIssuerHashHeader();
|
||||
}
|
||||
|
||||
public List<String> getRpTrustedIPs() {
|
||||
return rpTrustedIPs;
|
||||
return rppProperties.getTrustedIPs();
|
||||
}
|
||||
|
||||
public Boolean getAnonymousEnabled() {
|
||||
return anonymousEnabled;
|
||||
return authenticationsProperties.getEnabled();
|
||||
}
|
||||
|
||||
public void setRpCnHeader(final String rpCnHeader) {
|
||||
this.rpCnHeader = rpCnHeader;
|
||||
}
|
||||
|
||||
public void setRpSslIssuerHashHeader(final String rpSslIssuerHashHeader) {
|
||||
this.rpSslIssuerHashHeader = rpSslIssuerHashHeader;
|
||||
}
|
||||
|
||||
public void setRpTrustedIPs(final List<String> rpTrustedIPs) {
|
||||
this.rpTrustedIPs = rpTrustedIPs;
|
||||
}
|
||||
|
||||
public void setAnonymousEnabled(final Boolean anonymousEnabled) {
|
||||
this.anonymousEnabled = anonymousEnabled;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user