code formatting patched to be close to original and produce better difs
This commit is contained in:
parent
b117409531
commit
a49a2f1dc4
19 changed files with 8845 additions and 8834 deletions
|
@ -11,510 +11,510 @@ import java.util.Set;
|
||||||
* @version $Revision: 1 $
|
* @version $Revision: 1 $
|
||||||
*/
|
*/
|
||||||
public class RealmRepresentation {
|
public class RealmRepresentation {
|
||||||
protected String id;
|
protected String id;
|
||||||
protected String realm;
|
protected String realm;
|
||||||
protected Integer notBefore;
|
protected Integer notBefore;
|
||||||
protected Integer accessTokenLifespan;
|
protected Integer accessTokenLifespan;
|
||||||
protected Integer ssoSessionIdleTimeout;
|
protected Integer ssoSessionIdleTimeout;
|
||||||
protected Integer ssoSessionMaxLifespan;
|
protected Integer ssoSessionMaxLifespan;
|
||||||
protected Integer accessCodeLifespan;
|
protected Integer accessCodeLifespan;
|
||||||
protected Integer accessCodeLifespanUserAction;
|
protected Integer accessCodeLifespanUserAction;
|
||||||
protected Integer accessCodeLifespanLogin;
|
protected Integer accessCodeLifespanLogin;
|
||||||
protected Boolean enabled;
|
protected Boolean enabled;
|
||||||
protected String sslRequired;
|
protected String sslRequired;
|
||||||
protected Boolean passwordCredentialGrantAllowed;
|
protected Boolean passwordCredentialGrantAllowed;
|
||||||
protected Boolean registrationAllowed;
|
protected Boolean registrationAllowed;
|
||||||
protected Boolean registrationEmailAsUsername;
|
protected Boolean registrationEmailAsUsername;
|
||||||
protected Boolean rememberMe;
|
protected Boolean rememberMe;
|
||||||
protected Boolean verifyEmail;
|
protected Boolean verifyEmail;
|
||||||
protected Boolean resetPasswordAllowed;
|
protected Boolean resetPasswordAllowed;
|
||||||
|
|
||||||
protected Boolean userCacheEnabled;
|
protected Boolean userCacheEnabled;
|
||||||
protected Boolean realmCacheEnabled;
|
protected Boolean realmCacheEnabled;
|
||||||
|
|
||||||
// --- brute force settings
|
// --- brute force settings
|
||||||
protected Boolean bruteForceProtected;
|
protected Boolean bruteForceProtected;
|
||||||
protected Integer maxFailureWaitSeconds;
|
protected Integer maxFailureWaitSeconds;
|
||||||
protected Integer minimumQuickLoginWaitSeconds;
|
protected Integer minimumQuickLoginWaitSeconds;
|
||||||
protected Integer waitIncrementSeconds;
|
protected Integer waitIncrementSeconds;
|
||||||
protected Long quickLoginCheckMilliSeconds;
|
protected Long quickLoginCheckMilliSeconds;
|
||||||
protected Integer maxDeltaTimeSeconds;
|
protected Integer maxDeltaTimeSeconds;
|
||||||
protected Integer failureFactor;
|
protected Integer failureFactor;
|
||||||
// --- end brute force settings
|
// --- end brute force settings
|
||||||
|
|
||||||
protected String privateKey;
|
protected String privateKey;
|
||||||
protected String publicKey;
|
protected String publicKey;
|
||||||
protected String certificate;
|
protected String certificate;
|
||||||
protected String codeSecret;
|
protected String codeSecret;
|
||||||
protected RolesRepresentation roles;
|
protected RolesRepresentation roles;
|
||||||
protected List<String> defaultRoles;
|
protected List<String> defaultRoles;
|
||||||
protected Set<String> requiredCredentials;
|
protected Set<String> requiredCredentials;
|
||||||
protected String passwordPolicy;
|
protected String passwordPolicy;
|
||||||
protected List<UserRepresentation> users;
|
protected List<UserRepresentation> users;
|
||||||
protected List<ScopeMappingRepresentation> scopeMappings;
|
protected List<ScopeMappingRepresentation> scopeMappings;
|
||||||
protected Map<String, List<ScopeMappingRepresentation>> applicationScopeMappings;
|
protected Map<String, List<ScopeMappingRepresentation>> applicationScopeMappings;
|
||||||
protected List<ApplicationRepresentation> applications;
|
protected List<ApplicationRepresentation> applications;
|
||||||
protected List<OAuthClientRepresentation> oauthClients;
|
protected List<OAuthClientRepresentation> oauthClients;
|
||||||
protected Map<String, String> browserSecurityHeaders;
|
protected Map<String, String> browserSecurityHeaders;
|
||||||
protected Map<String, String> smtpServer;
|
protected Map<String, String> smtpServer;
|
||||||
protected List<UserFederationProviderRepresentation> userFederationProviders;
|
protected List<UserFederationProviderRepresentation> userFederationProviders;
|
||||||
protected String loginTheme;
|
protected String loginTheme;
|
||||||
protected String accountTheme;
|
protected String accountTheme;
|
||||||
protected String adminTheme;
|
protected String adminTheme;
|
||||||
protected String emailTheme;
|
protected String emailTheme;
|
||||||
protected Boolean eventsEnabled;
|
protected Boolean eventsEnabled;
|
||||||
protected Long eventsExpiration;
|
protected Long eventsExpiration;
|
||||||
protected List<String> eventsListeners;
|
protected List<String> eventsListeners;
|
||||||
private List<IdentityProviderRepresentation> identityProviders;
|
private List<IdentityProviderRepresentation> identityProviders;
|
||||||
private List<ProtocolMapperRepresentation> protocolMappers;
|
private List<ProtocolMapperRepresentation> protocolMappers;
|
||||||
private Boolean identityFederationEnabled;
|
private Boolean identityFederationEnabled;
|
||||||
|
|
||||||
public String getId() {
|
public String getId() {
|
||||||
return id;
|
return id;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setId(String id) {
|
public void setId(String id) {
|
||||||
this.id = id;
|
this.id = id;
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getRealm() {
|
public String getRealm() {
|
||||||
return realm;
|
return realm;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setRealm(String realm) {
|
public void setRealm(String realm) {
|
||||||
this.realm = realm;
|
this.realm = realm;
|
||||||
}
|
}
|
||||||
|
|
||||||
public List<UserRepresentation> getUsers() {
|
public List<UserRepresentation> getUsers() {
|
||||||
return users;
|
return users;
|
||||||
}
|
}
|
||||||
|
|
||||||
public List<ApplicationRepresentation> getApplications() {
|
public List<ApplicationRepresentation> getApplications() {
|
||||||
return applications;
|
return applications;
|
||||||
}
|
}
|
||||||
|
|
||||||
public ApplicationRepresentation resource(String name) {
|
public ApplicationRepresentation resource(String name) {
|
||||||
ApplicationRepresentation resource = new ApplicationRepresentation();
|
ApplicationRepresentation resource = new ApplicationRepresentation();
|
||||||
if (applications == null)
|
if (applications == null)
|
||||||
applications = new ArrayList<ApplicationRepresentation>();
|
applications = new ArrayList<ApplicationRepresentation>();
|
||||||
applications.add(resource);
|
applications.add(resource);
|
||||||
resource.setName(name);
|
resource.setName(name);
|
||||||
return resource;
|
return resource;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setUsers(List<UserRepresentation> users) {
|
public void setUsers(List<UserRepresentation> users) {
|
||||||
this.users = users;
|
this.users = users;
|
||||||
}
|
}
|
||||||
|
|
||||||
public UserRepresentation user(String username) {
|
public UserRepresentation user(String username) {
|
||||||
UserRepresentation user = new UserRepresentation();
|
UserRepresentation user = new UserRepresentation();
|
||||||
user.setUsername(username);
|
user.setUsername(username);
|
||||||
if (users == null)
|
if (users == null)
|
||||||
users = new ArrayList<UserRepresentation>();
|
users = new ArrayList<UserRepresentation>();
|
||||||
users.add(user);
|
users.add(user);
|
||||||
return user;
|
return user;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setApplications(List<ApplicationRepresentation> applications) {
|
public void setApplications(List<ApplicationRepresentation> applications) {
|
||||||
this.applications = applications;
|
this.applications = applications;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Boolean isEnabled() {
|
public Boolean isEnabled() {
|
||||||
return enabled;
|
return enabled;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setEnabled(Boolean enabled) {
|
public void setEnabled(Boolean enabled) {
|
||||||
this.enabled = enabled;
|
this.enabled = enabled;
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getSslRequired() {
|
public String getSslRequired() {
|
||||||
return sslRequired;
|
return sslRequired;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setSslRequired(String sslRequired) {
|
public void setSslRequired(String sslRequired) {
|
||||||
this.sslRequired = sslRequired;
|
this.sslRequired = sslRequired;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Integer getAccessTokenLifespan() {
|
public Integer getAccessTokenLifespan() {
|
||||||
return accessTokenLifespan;
|
return accessTokenLifespan;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setAccessTokenLifespan(Integer accessTokenLifespan) {
|
public void setAccessTokenLifespan(Integer accessTokenLifespan) {
|
||||||
this.accessTokenLifespan = accessTokenLifespan;
|
this.accessTokenLifespan = accessTokenLifespan;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Integer getSsoSessionIdleTimeout() {
|
public Integer getSsoSessionIdleTimeout() {
|
||||||
return ssoSessionIdleTimeout;
|
return ssoSessionIdleTimeout;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setSsoSessionIdleTimeout(Integer ssoSessionIdleTimeout) {
|
public void setSsoSessionIdleTimeout(Integer ssoSessionIdleTimeout) {
|
||||||
this.ssoSessionIdleTimeout = ssoSessionIdleTimeout;
|
this.ssoSessionIdleTimeout = ssoSessionIdleTimeout;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Integer getSsoSessionMaxLifespan() {
|
public Integer getSsoSessionMaxLifespan() {
|
||||||
return ssoSessionMaxLifespan;
|
return ssoSessionMaxLifespan;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setSsoSessionMaxLifespan(Integer ssoSessionMaxLifespan) {
|
public void setSsoSessionMaxLifespan(Integer ssoSessionMaxLifespan) {
|
||||||
this.ssoSessionMaxLifespan = ssoSessionMaxLifespan;
|
this.ssoSessionMaxLifespan = ssoSessionMaxLifespan;
|
||||||
}
|
}
|
||||||
|
|
||||||
public List<ScopeMappingRepresentation> getScopeMappings() {
|
public List<ScopeMappingRepresentation> getScopeMappings() {
|
||||||
return scopeMappings;
|
return scopeMappings;
|
||||||
}
|
}
|
||||||
|
|
||||||
public ScopeMappingRepresentation scopeMapping(String username) {
|
public ScopeMappingRepresentation scopeMapping(String username) {
|
||||||
ScopeMappingRepresentation mapping = new ScopeMappingRepresentation();
|
ScopeMappingRepresentation mapping = new ScopeMappingRepresentation();
|
||||||
mapping.setClient(username);
|
mapping.setClient(username);
|
||||||
if (scopeMappings == null)
|
if (scopeMappings == null)
|
||||||
scopeMappings = new ArrayList<ScopeMappingRepresentation>();
|
scopeMappings = new ArrayList<ScopeMappingRepresentation>();
|
||||||
scopeMappings.add(mapping);
|
scopeMappings.add(mapping);
|
||||||
return mapping;
|
return mapping;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Set<String> getRequiredCredentials() {
|
public Set<String> getRequiredCredentials() {
|
||||||
return requiredCredentials;
|
return requiredCredentials;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setRequiredCredentials(Set<String> requiredCredentials) {
|
public void setRequiredCredentials(Set<String> requiredCredentials) {
|
||||||
this.requiredCredentials = requiredCredentials;
|
this.requiredCredentials = requiredCredentials;
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getPasswordPolicy() {
|
public String getPasswordPolicy() {
|
||||||
return passwordPolicy;
|
return passwordPolicy;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setPasswordPolicy(String passwordPolicy) {
|
public void setPasswordPolicy(String passwordPolicy) {
|
||||||
this.passwordPolicy = passwordPolicy;
|
this.passwordPolicy = passwordPolicy;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Integer getAccessCodeLifespan() {
|
public Integer getAccessCodeLifespan() {
|
||||||
return accessCodeLifespan;
|
return accessCodeLifespan;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setAccessCodeLifespan(Integer accessCodeLifespan) {
|
public void setAccessCodeLifespan(Integer accessCodeLifespan) {
|
||||||
this.accessCodeLifespan = accessCodeLifespan;
|
this.accessCodeLifespan = accessCodeLifespan;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Integer getAccessCodeLifespanUserAction() {
|
public Integer getAccessCodeLifespanUserAction() {
|
||||||
return accessCodeLifespanUserAction;
|
return accessCodeLifespanUserAction;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setAccessCodeLifespanUserAction(Integer accessCodeLifespanUserAction) {
|
public void setAccessCodeLifespanUserAction(Integer accessCodeLifespanUserAction) {
|
||||||
this.accessCodeLifespanUserAction = accessCodeLifespanUserAction;
|
this.accessCodeLifespanUserAction = accessCodeLifespanUserAction;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Integer getAccessCodeLifespanLogin() {
|
public Integer getAccessCodeLifespanLogin() {
|
||||||
return accessCodeLifespanLogin;
|
return accessCodeLifespanLogin;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setAccessCodeLifespanLogin(Integer accessCodeLifespanLogin) {
|
public void setAccessCodeLifespanLogin(Integer accessCodeLifespanLogin) {
|
||||||
this.accessCodeLifespanLogin = accessCodeLifespanLogin;
|
this.accessCodeLifespanLogin = accessCodeLifespanLogin;
|
||||||
}
|
}
|
||||||
|
|
||||||
public List<String> getDefaultRoles() {
|
public List<String> getDefaultRoles() {
|
||||||
return defaultRoles;
|
return defaultRoles;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setDefaultRoles(List<String> defaultRoles) {
|
public void setDefaultRoles(List<String> defaultRoles) {
|
||||||
this.defaultRoles = defaultRoles;
|
this.defaultRoles = defaultRoles;
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getPrivateKey() {
|
public String getPrivateKey() {
|
||||||
return privateKey;
|
return privateKey;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setPrivateKey(String privateKey) {
|
public void setPrivateKey(String privateKey) {
|
||||||
this.privateKey = privateKey;
|
this.privateKey = privateKey;
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getPublicKey() {
|
public String getPublicKey() {
|
||||||
return publicKey;
|
return publicKey;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setPublicKey(String publicKey) {
|
public void setPublicKey(String publicKey) {
|
||||||
this.publicKey = publicKey;
|
this.publicKey = publicKey;
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getCertificate() {
|
public String getCertificate() {
|
||||||
return certificate;
|
return certificate;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setCertificate(String certificate) {
|
public void setCertificate(String certificate) {
|
||||||
this.certificate = certificate;
|
this.certificate = certificate;
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getCodeSecret() {
|
public String getCodeSecret() {
|
||||||
return codeSecret;
|
return codeSecret;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setCodeSecret(String codeSecret) {
|
public void setCodeSecret(String codeSecret) {
|
||||||
this.codeSecret = codeSecret;
|
this.codeSecret = codeSecret;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Boolean isPasswordCredentialGrantAllowed() {
|
public Boolean isPasswordCredentialGrantAllowed() {
|
||||||
return passwordCredentialGrantAllowed;
|
return passwordCredentialGrantAllowed;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setPasswordCredentialGrantAllowed(Boolean passwordCredentialGrantAllowed) {
|
public void setPasswordCredentialGrantAllowed(Boolean passwordCredentialGrantAllowed) {
|
||||||
this.passwordCredentialGrantAllowed = passwordCredentialGrantAllowed;
|
this.passwordCredentialGrantAllowed = passwordCredentialGrantAllowed;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Boolean isRegistrationAllowed() {
|
public Boolean isRegistrationAllowed() {
|
||||||
return registrationAllowed;
|
return registrationAllowed;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setRegistrationAllowed(Boolean registrationAllowed) {
|
public void setRegistrationAllowed(Boolean registrationAllowed) {
|
||||||
this.registrationAllowed = registrationAllowed;
|
this.registrationAllowed = registrationAllowed;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Boolean isRegistrationEmailAsUsername() {
|
public Boolean isRegistrationEmailAsUsername() {
|
||||||
return registrationEmailAsUsername;
|
return registrationEmailAsUsername;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setRegistrationEmailAsUsername(boolean registrationEmailAsUsername) {
|
public void setRegistrationEmailAsUsername(boolean registrationEmailAsUsername) {
|
||||||
this.registrationEmailAsUsername = registrationEmailAsUsername;
|
this.registrationEmailAsUsername = registrationEmailAsUsername;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Boolean isRememberMe() {
|
public Boolean isRememberMe() {
|
||||||
return rememberMe;
|
return rememberMe;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setRememberMe(Boolean rememberMe) {
|
public void setRememberMe(Boolean rememberMe) {
|
||||||
this.rememberMe = rememberMe;
|
this.rememberMe = rememberMe;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Boolean isRealmCacheEnabled() {
|
public Boolean isRealmCacheEnabled() {
|
||||||
return realmCacheEnabled;
|
return realmCacheEnabled;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setRealmCacheEnabled(Boolean realmCacheEnabled) {
|
public void setRealmCacheEnabled(Boolean realmCacheEnabled) {
|
||||||
this.realmCacheEnabled = realmCacheEnabled;
|
this.realmCacheEnabled = realmCacheEnabled;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Boolean isUserCacheEnabled() {
|
public Boolean isUserCacheEnabled() {
|
||||||
return userCacheEnabled;
|
return userCacheEnabled;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setUserCacheEnabled(Boolean userCacheEnabled) {
|
public void setUserCacheEnabled(Boolean userCacheEnabled) {
|
||||||
this.userCacheEnabled = userCacheEnabled;
|
this.userCacheEnabled = userCacheEnabled;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Boolean isVerifyEmail() {
|
public Boolean isVerifyEmail() {
|
||||||
return verifyEmail;
|
return verifyEmail;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setVerifyEmail(Boolean verifyEmail) {
|
public void setVerifyEmail(Boolean verifyEmail) {
|
||||||
this.verifyEmail = verifyEmail;
|
this.verifyEmail = verifyEmail;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Boolean isResetPasswordAllowed() {
|
public Boolean isResetPasswordAllowed() {
|
||||||
return resetPasswordAllowed;
|
return resetPasswordAllowed;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setResetPasswordAllowed(Boolean resetPassword) {
|
public void setResetPasswordAllowed(Boolean resetPassword) {
|
||||||
this.resetPasswordAllowed = resetPassword;
|
this.resetPasswordAllowed = resetPassword;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Map<String, String> getBrowserSecurityHeaders() {
|
public Map<String, String> getBrowserSecurityHeaders() {
|
||||||
return browserSecurityHeaders;
|
return browserSecurityHeaders;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setBrowserSecurityHeaders(Map<String, String> browserSecurityHeaders) {
|
public void setBrowserSecurityHeaders(Map<String, String> browserSecurityHeaders) {
|
||||||
this.browserSecurityHeaders = browserSecurityHeaders;
|
this.browserSecurityHeaders = browserSecurityHeaders;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Map<String, String> getSmtpServer() {
|
public Map<String, String> getSmtpServer() {
|
||||||
return smtpServer;
|
return smtpServer;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setSmtpServer(Map<String, String> smtpServer) {
|
public void setSmtpServer(Map<String, String> smtpServer) {
|
||||||
this.smtpServer = smtpServer;
|
this.smtpServer = smtpServer;
|
||||||
}
|
}
|
||||||
|
|
||||||
public List<OAuthClientRepresentation> getOauthClients() {
|
public List<OAuthClientRepresentation> getOauthClients() {
|
||||||
return oauthClients;
|
return oauthClients;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setOauthClients(List<OAuthClientRepresentation> oauthClients) {
|
public void setOauthClients(List<OAuthClientRepresentation> oauthClients) {
|
||||||
this.oauthClients = oauthClients;
|
this.oauthClients = oauthClients;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Map<String, List<ScopeMappingRepresentation>> getApplicationScopeMappings() {
|
public Map<String, List<ScopeMappingRepresentation>> getApplicationScopeMappings() {
|
||||||
return applicationScopeMappings;
|
return applicationScopeMappings;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setApplicationScopeMappings(Map<String, List<ScopeMappingRepresentation>> applicationScopeMappings) {
|
public void setApplicationScopeMappings(Map<String, List<ScopeMappingRepresentation>> applicationScopeMappings) {
|
||||||
this.applicationScopeMappings = applicationScopeMappings;
|
this.applicationScopeMappings = applicationScopeMappings;
|
||||||
}
|
}
|
||||||
|
|
||||||
public RolesRepresentation getRoles() {
|
public RolesRepresentation getRoles() {
|
||||||
return roles;
|
return roles;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setRoles(RolesRepresentation roles) {
|
public void setRoles(RolesRepresentation roles) {
|
||||||
this.roles = roles;
|
this.roles = roles;
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getLoginTheme() {
|
public String getLoginTheme() {
|
||||||
return loginTheme;
|
return loginTheme;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setLoginTheme(String loginTheme) {
|
public void setLoginTheme(String loginTheme) {
|
||||||
this.loginTheme = loginTheme;
|
this.loginTheme = loginTheme;
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getAccountTheme() {
|
public String getAccountTheme() {
|
||||||
return accountTheme;
|
return accountTheme;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setAccountTheme(String accountTheme) {
|
public void setAccountTheme(String accountTheme) {
|
||||||
this.accountTheme = accountTheme;
|
this.accountTheme = accountTheme;
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getAdminTheme() {
|
public String getAdminTheme() {
|
||||||
return adminTheme;
|
return adminTheme;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setAdminTheme(String adminTheme) {
|
public void setAdminTheme(String adminTheme) {
|
||||||
this.adminTheme = adminTheme;
|
this.adminTheme = adminTheme;
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getEmailTheme() {
|
public String getEmailTheme() {
|
||||||
return emailTheme;
|
return emailTheme;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setEmailTheme(String emailTheme) {
|
public void setEmailTheme(String emailTheme) {
|
||||||
this.emailTheme = emailTheme;
|
this.emailTheme = emailTheme;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Integer getNotBefore() {
|
public Integer getNotBefore() {
|
||||||
return notBefore;
|
return notBefore;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setNotBefore(Integer notBefore) {
|
public void setNotBefore(Integer notBefore) {
|
||||||
this.notBefore = notBefore;
|
this.notBefore = notBefore;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Boolean isBruteForceProtected() {
|
public Boolean isBruteForceProtected() {
|
||||||
return bruteForceProtected;
|
return bruteForceProtected;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setBruteForceProtected(Boolean bruteForceProtected) {
|
public void setBruteForceProtected(Boolean bruteForceProtected) {
|
||||||
this.bruteForceProtected = bruteForceProtected;
|
this.bruteForceProtected = bruteForceProtected;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Integer getMaxFailureWaitSeconds() {
|
public Integer getMaxFailureWaitSeconds() {
|
||||||
return maxFailureWaitSeconds;
|
return maxFailureWaitSeconds;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setMaxFailureWaitSeconds(Integer maxFailureWaitSeconds) {
|
public void setMaxFailureWaitSeconds(Integer maxFailureWaitSeconds) {
|
||||||
this.maxFailureWaitSeconds = maxFailureWaitSeconds;
|
this.maxFailureWaitSeconds = maxFailureWaitSeconds;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Integer getMinimumQuickLoginWaitSeconds() {
|
public Integer getMinimumQuickLoginWaitSeconds() {
|
||||||
return minimumQuickLoginWaitSeconds;
|
return minimumQuickLoginWaitSeconds;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setMinimumQuickLoginWaitSeconds(Integer minimumQuickLoginWaitSeconds) {
|
public void setMinimumQuickLoginWaitSeconds(Integer minimumQuickLoginWaitSeconds) {
|
||||||
this.minimumQuickLoginWaitSeconds = minimumQuickLoginWaitSeconds;
|
this.minimumQuickLoginWaitSeconds = minimumQuickLoginWaitSeconds;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Integer getWaitIncrementSeconds() {
|
public Integer getWaitIncrementSeconds() {
|
||||||
return waitIncrementSeconds;
|
return waitIncrementSeconds;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setWaitIncrementSeconds(Integer waitIncrementSeconds) {
|
public void setWaitIncrementSeconds(Integer waitIncrementSeconds) {
|
||||||
this.waitIncrementSeconds = waitIncrementSeconds;
|
this.waitIncrementSeconds = waitIncrementSeconds;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Long getQuickLoginCheckMilliSeconds() {
|
public Long getQuickLoginCheckMilliSeconds() {
|
||||||
return quickLoginCheckMilliSeconds;
|
return quickLoginCheckMilliSeconds;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setQuickLoginCheckMilliSeconds(Long quickLoginCheckMilliSeconds) {
|
public void setQuickLoginCheckMilliSeconds(Long quickLoginCheckMilliSeconds) {
|
||||||
this.quickLoginCheckMilliSeconds = quickLoginCheckMilliSeconds;
|
this.quickLoginCheckMilliSeconds = quickLoginCheckMilliSeconds;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Integer getMaxDeltaTimeSeconds() {
|
public Integer getMaxDeltaTimeSeconds() {
|
||||||
return maxDeltaTimeSeconds;
|
return maxDeltaTimeSeconds;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setMaxDeltaTimeSeconds(Integer maxDeltaTimeSeconds) {
|
public void setMaxDeltaTimeSeconds(Integer maxDeltaTimeSeconds) {
|
||||||
this.maxDeltaTimeSeconds = maxDeltaTimeSeconds;
|
this.maxDeltaTimeSeconds = maxDeltaTimeSeconds;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Integer getFailureFactor() {
|
public Integer getFailureFactor() {
|
||||||
return failureFactor;
|
return failureFactor;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setFailureFactor(Integer failureFactor) {
|
public void setFailureFactor(Integer failureFactor) {
|
||||||
this.failureFactor = failureFactor;
|
this.failureFactor = failureFactor;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Boolean isEventsEnabled() {
|
public Boolean isEventsEnabled() {
|
||||||
return eventsEnabled;
|
return eventsEnabled;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setEventsEnabled(boolean eventsEnabled) {
|
public void setEventsEnabled(boolean eventsEnabled) {
|
||||||
this.eventsEnabled = eventsEnabled;
|
this.eventsEnabled = eventsEnabled;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Long getEventsExpiration() {
|
public Long getEventsExpiration() {
|
||||||
return eventsExpiration;
|
return eventsExpiration;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setEventsExpiration(long eventsExpiration) {
|
public void setEventsExpiration(long eventsExpiration) {
|
||||||
this.eventsExpiration = eventsExpiration;
|
this.eventsExpiration = eventsExpiration;
|
||||||
}
|
}
|
||||||
|
|
||||||
public List<String> getEventsListeners() {
|
public List<String> getEventsListeners() {
|
||||||
return eventsListeners;
|
return eventsListeners;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setEventsListeners(List<String> eventsListeners) {
|
public void setEventsListeners(List<String> eventsListeners) {
|
||||||
this.eventsListeners = eventsListeners;
|
this.eventsListeners = eventsListeners;
|
||||||
}
|
}
|
||||||
|
|
||||||
public List<UserFederationProviderRepresentation> getUserFederationProviders() {
|
public List<UserFederationProviderRepresentation> getUserFederationProviders() {
|
||||||
return userFederationProviders;
|
return userFederationProviders;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setUserFederationProviders(List<UserFederationProviderRepresentation> userFederationProviders) {
|
public void setUserFederationProviders(List<UserFederationProviderRepresentation> userFederationProviders) {
|
||||||
this.userFederationProviders = userFederationProviders;
|
this.userFederationProviders = userFederationProviders;
|
||||||
}
|
}
|
||||||
|
|
||||||
public List<IdentityProviderRepresentation> getIdentityProviders() {
|
public List<IdentityProviderRepresentation> getIdentityProviders() {
|
||||||
if (this.identityProviders == null) {
|
if (this.identityProviders == null) {
|
||||||
this.identityProviders = new ArrayList<IdentityProviderRepresentation>();
|
this.identityProviders = new ArrayList<IdentityProviderRepresentation>();
|
||||||
}
|
}
|
||||||
|
|
||||||
return identityProviders;
|
return identityProviders;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setIdentityProviders(List<IdentityProviderRepresentation> identityProviders) {
|
public void setIdentityProviders(List<IdentityProviderRepresentation> identityProviders) {
|
||||||
this.identityProviders = identityProviders;
|
this.identityProviders = identityProviders;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void addIdentityProvider(IdentityProviderRepresentation identityProviderRepresentation) {
|
public void addIdentityProvider(IdentityProviderRepresentation identityProviderRepresentation) {
|
||||||
getIdentityProviders().add(identityProviderRepresentation);
|
getIdentityProviders().add(identityProviderRepresentation);
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean isIdentityFederationEnabled() {
|
public boolean isIdentityFederationEnabled() {
|
||||||
return !getIdentityProviders().isEmpty();
|
return !getIdentityProviders().isEmpty();
|
||||||
}
|
}
|
||||||
|
|
||||||
public List<ProtocolMapperRepresentation> getProtocolMappers() {
|
public List<ProtocolMapperRepresentation> getProtocolMappers() {
|
||||||
return protocolMappers;
|
return protocolMappers;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void addProtocolMapper(ProtocolMapperRepresentation rep) {
|
public void addProtocolMapper(ProtocolMapperRepresentation rep) {
|
||||||
if (protocolMappers == null)
|
if (protocolMappers == null)
|
||||||
protocolMappers = new LinkedList<ProtocolMapperRepresentation>();
|
protocolMappers = new LinkedList<ProtocolMapperRepresentation>();
|
||||||
protocolMappers.add(rep);
|
protocolMappers.add(rep);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setProtocolMappers(List<ProtocolMapperRepresentation> protocolMappers) {
|
public void setProtocolMappers(List<ProtocolMapperRepresentation> protocolMappers) {
|
||||||
this.protocolMappers = protocolMappers;
|
this.protocolMappers = protocolMappers;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -5,43 +5,43 @@ package org.keycloak.events;
|
||||||
*/
|
*/
|
||||||
public interface Errors {
|
public interface Errors {
|
||||||
|
|
||||||
String REALM_DISABLED = "realm_disabled";
|
String REALM_DISABLED = "realm_disabled";
|
||||||
|
|
||||||
String CLIENT_NOT_FOUND = "client_not_found";
|
String CLIENT_NOT_FOUND = "client_not_found";
|
||||||
String CLIENT_DISABLED = "client_disabled";
|
String CLIENT_DISABLED = "client_disabled";
|
||||||
String INVALID_CLIENT_CREDENTIALS = "invalid_client_credentials";
|
String INVALID_CLIENT_CREDENTIALS = "invalid_client_credentials";
|
||||||
String INVALID_CLIENT = "invalid_client";
|
String INVALID_CLIENT = "invalid_client";
|
||||||
|
|
||||||
String USER_NOT_FOUND = "user_not_found";
|
String USER_NOT_FOUND = "user_not_found";
|
||||||
String USER_DISABLED = "user_disabled";
|
String USER_DISABLED = "user_disabled";
|
||||||
String USER_TEMPORARILY_DISABLED = "user_temporarily_disabled";
|
String USER_TEMPORARILY_DISABLED = "user_temporarily_disabled";
|
||||||
String INVALID_USER_CREDENTIALS = "invalid_user_credentials";
|
String INVALID_USER_CREDENTIALS = "invalid_user_credentials";
|
||||||
|
|
||||||
String USERNAME_MISSING = "username_missing";
|
String USERNAME_MISSING = "username_missing";
|
||||||
String USERNAME_IN_USE = "username_in_use";
|
String USERNAME_IN_USE = "username_in_use";
|
||||||
String EMAIL_IN_USE = "email_in_use";
|
String EMAIL_IN_USE = "email_in_use";
|
||||||
|
|
||||||
String INVALID_REDIRECT_URI = "invalid_redirect_uri";
|
String INVALID_REDIRECT_URI = "invalid_redirect_uri";
|
||||||
String INVALID_CODE = "invalid_code";
|
String INVALID_CODE = "invalid_code";
|
||||||
String INVALID_TOKEN = "invalid_token";
|
String INVALID_TOKEN = "invalid_token";
|
||||||
String INVALID_SIGNATURE = "invalid_signature";
|
String INVALID_SIGNATURE = "invalid_signature";
|
||||||
String INVALID_REGISTRATION = "invalid_registration";
|
String INVALID_REGISTRATION = "invalid_registration";
|
||||||
String INVALID_FORM = "invalid_form";
|
String INVALID_FORM = "invalid_form";
|
||||||
String EXPIRED_CODE = "expired_code";
|
String EXPIRED_CODE = "expired_code";
|
||||||
|
|
||||||
String REGISTRATION_DISABLED = "registration_disabled";
|
String REGISTRATION_DISABLED = "registration_disabled";
|
||||||
|
|
||||||
String REJECTED_BY_USER = "rejected_by_user";
|
String REJECTED_BY_USER = "rejected_by_user";
|
||||||
|
|
||||||
String NOT_ALLOWED = "not_allowed";
|
String NOT_ALLOWED = "not_allowed";
|
||||||
|
|
||||||
String FEDERATED_IDENTITY_EMAIL_EXISTS = "federated_identity_email_exists";
|
String FEDERATED_IDENTITY_EMAIL_EXISTS = "federated_identity_email_exists";
|
||||||
String FEDERATED_IDENTITY_REGISTRATION_EMAIL_MISSING = "federated_identity_registration_email_missing";
|
String FEDERATED_IDENTITY_REGISTRATION_EMAIL_MISSING = "federated_identity_registration_email_missing";
|
||||||
String FEDERATED_IDENTITY_USERNAME_EXISTS = "federated_identity_username_exists";
|
String FEDERATED_IDENTITY_USERNAME_EXISTS = "federated_identity_username_exists";
|
||||||
String SSL_REQUIRED = "ssl_required";
|
String SSL_REQUIRED = "ssl_required";
|
||||||
|
|
||||||
String USER_SESSION_NOT_FOUND = "user_session_not_found";
|
String USER_SESSION_NOT_FOUND = "user_session_not_found";
|
||||||
|
|
||||||
String EMAIL_SEND_FAILED = "email_send_failed";
|
String EMAIL_SEND_FAILED = "email_send_failed";
|
||||||
String INVALID_EMAIL = "invalid_email";
|
String INVALID_EMAIL = "invalid_email";
|
||||||
}
|
}
|
||||||
|
|
|
@ -30,43 +30,43 @@ import org.keycloak.representations.idm.CredentialRepresentation;
|
||||||
*/
|
*/
|
||||||
public class RealmBean {
|
public class RealmBean {
|
||||||
|
|
||||||
private RealmModel realm;
|
private RealmModel realm;
|
||||||
|
|
||||||
public RealmBean(RealmModel realmModel) {
|
public RealmBean(RealmModel realmModel) {
|
||||||
realm = realmModel;
|
realm = realmModel;
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getName() {
|
public String getName() {
|
||||||
return realm.getName();
|
return realm.getName();
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean isIdentityFederationEnabled() {
|
public boolean isIdentityFederationEnabled() {
|
||||||
return realm.isIdentityFederationEnabled();
|
return realm.isIdentityFederationEnabled();
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean isRegistrationAllowed() {
|
public boolean isRegistrationAllowed() {
|
||||||
return realm.isRegistrationAllowed();
|
return realm.isRegistrationAllowed();
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean isRegistrationEmailAsUsername() {
|
public boolean isRegistrationEmailAsUsername() {
|
||||||
return realm.isRegistrationEmailAsUsername();
|
return realm.isRegistrationEmailAsUsername();
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean isResetPasswordAllowed() {
|
public boolean isResetPasswordAllowed() {
|
||||||
return realm.isResetPasswordAllowed();
|
return realm.isResetPasswordAllowed();
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean isRememberMe() {
|
public boolean isRememberMe() {
|
||||||
return realm.isRememberMe();
|
return realm.isRememberMe();
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean isPassword() {
|
public boolean isPassword() {
|
||||||
for (RequiredCredentialModel r : realm.getRequiredCredentials()) {
|
for (RequiredCredentialModel r : realm.getRequiredCredentials()) {
|
||||||
if (r.getType().equals(CredentialRepresentation.PASSWORD)) {
|
if (r.getType().equals(CredentialRepresentation.PASSWORD)) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -16,264 +16,240 @@ import org.keycloak.provider.ProviderEvent;
|
||||||
* @version $Revision: 1 $
|
* @version $Revision: 1 $
|
||||||
*/
|
*/
|
||||||
public interface RealmModel extends RoleContainerModel {
|
public interface RealmModel extends RoleContainerModel {
|
||||||
interface RealmCreationEvent extends ProviderEvent {
|
interface RealmCreationEvent extends ProviderEvent {
|
||||||
RealmModel getCreatedRealm();
|
RealmModel getCreatedRealm();
|
||||||
}
|
}
|
||||||
|
interface ClientCreationEvent extends ProviderEvent {
|
||||||
|
ClientModel getCreatedClient();
|
||||||
|
}
|
||||||
|
interface ApplicationCreationEvent extends ClientCreationEvent {
|
||||||
|
ApplicationModel getCreatedApplication();
|
||||||
|
}
|
||||||
|
interface OAuthClientCreationEvent extends ClientCreationEvent {
|
||||||
|
OAuthClientModel getCreatedOAuthClient();
|
||||||
|
}
|
||||||
|
|
||||||
interface ClientCreationEvent extends ProviderEvent {
|
String getId();
|
||||||
ClientModel getCreatedClient();
|
|
||||||
}
|
|
||||||
|
|
||||||
interface ApplicationCreationEvent extends ClientCreationEvent {
|
String getName();
|
||||||
ApplicationModel getCreatedApplication();
|
|
||||||
}
|
|
||||||
|
|
||||||
interface OAuthClientCreationEvent extends ClientCreationEvent {
|
void setName(String name);
|
||||||
OAuthClientModel getCreatedOAuthClient();
|
|
||||||
}
|
|
||||||
|
|
||||||
String getId();
|
boolean isEnabled();
|
||||||
|
|
||||||
String getName();
|
void setEnabled(boolean enabled);
|
||||||
|
|
||||||
void setName(String name);
|
SslRequired getSslRequired();
|
||||||
|
|
||||||
boolean isEnabled();
|
void setSslRequired(SslRequired sslRequired);
|
||||||
|
|
||||||
void setEnabled(boolean enabled);
|
boolean isRegistrationAllowed();
|
||||||
|
|
||||||
SslRequired getSslRequired();
|
void setRegistrationAllowed(boolean registrationAllowed);
|
||||||
|
|
||||||
void setSslRequired(SslRequired sslRequired);
|
public boolean isRegistrationEmailAsUsername();
|
||||||
|
|
||||||
boolean isRegistrationAllowed();
|
public void setRegistrationEmailAsUsername(boolean registrationEmailAsUsername);
|
||||||
|
|
||||||
void setRegistrationAllowed(boolean registrationAllowed);
|
boolean isPasswordCredentialGrantAllowed();
|
||||||
|
|
||||||
public boolean isRegistrationEmailAsUsername();
|
void setPasswordCredentialGrantAllowed(boolean passwordCredentialGrantAllowed);
|
||||||
|
|
||||||
public void setRegistrationEmailAsUsername(boolean registrationEmailAsUsername);
|
boolean isRememberMe();
|
||||||
|
|
||||||
boolean isPasswordCredentialGrantAllowed();
|
void setRememberMe(boolean rememberMe);
|
||||||
|
|
||||||
void setPasswordCredentialGrantAllowed(boolean passwordCredentialGrantAllowed);
|
//--- brute force settings
|
||||||
|
boolean isBruteForceProtected();
|
||||||
|
void setBruteForceProtected(boolean value);
|
||||||
|
int getMaxFailureWaitSeconds();
|
||||||
|
void setMaxFailureWaitSeconds(int val);
|
||||||
|
int getWaitIncrementSeconds();
|
||||||
|
void setWaitIncrementSeconds(int val);
|
||||||
|
int getMinimumQuickLoginWaitSeconds();
|
||||||
|
void setMinimumQuickLoginWaitSeconds(int val);
|
||||||
|
long getQuickLoginCheckMilliSeconds();
|
||||||
|
void setQuickLoginCheckMilliSeconds(long val);
|
||||||
|
int getMaxDeltaTimeSeconds();
|
||||||
|
void setMaxDeltaTimeSeconds(int val);
|
||||||
|
int getFailureFactor();
|
||||||
|
void setFailureFactor(int failureFactor);
|
||||||
|
//--- end brute force settings
|
||||||
|
|
||||||
boolean isRememberMe();
|
|
||||||
|
|
||||||
void setRememberMe(boolean rememberMe);
|
boolean isVerifyEmail();
|
||||||
|
|
||||||
// --- brute force settings
|
void setVerifyEmail(boolean verifyEmail);
|
||||||
boolean isBruteForceProtected();
|
|
||||||
|
|
||||||
void setBruteForceProtected(boolean value);
|
boolean isResetPasswordAllowed();
|
||||||
|
|
||||||
int getMaxFailureWaitSeconds();
|
void setResetPasswordAllowed(boolean resetPasswordAllowed);
|
||||||
|
|
||||||
void setMaxFailureWaitSeconds(int val);
|
int getSsoSessionIdleTimeout();
|
||||||
|
void setSsoSessionIdleTimeout(int seconds);
|
||||||
|
|
||||||
int getWaitIncrementSeconds();
|
int getSsoSessionMaxLifespan();
|
||||||
|
void setSsoSessionMaxLifespan(int seconds);
|
||||||
|
|
||||||
void setWaitIncrementSeconds(int val);
|
int getAccessTokenLifespan();
|
||||||
|
|
||||||
int getMinimumQuickLoginWaitSeconds();
|
void setAccessTokenLifespan(int seconds);
|
||||||
|
|
||||||
void setMinimumQuickLoginWaitSeconds(int val);
|
int getAccessCodeLifespan();
|
||||||
|
|
||||||
long getQuickLoginCheckMilliSeconds();
|
void setAccessCodeLifespan(int seconds);
|
||||||
|
|
||||||
void setQuickLoginCheckMilliSeconds(long val);
|
int getAccessCodeLifespanUserAction();
|
||||||
|
|
||||||
int getMaxDeltaTimeSeconds();
|
void setAccessCodeLifespanUserAction(int seconds);
|
||||||
|
|
||||||
void setMaxDeltaTimeSeconds(int val);
|
int getAccessCodeLifespanLogin();
|
||||||
|
|
||||||
int getFailureFactor();
|
void setAccessCodeLifespanLogin(int seconds);
|
||||||
|
|
||||||
void setFailureFactor(int failureFactor);
|
String getPublicKeyPem();
|
||||||
|
|
||||||
// --- end brute force settings
|
void setPublicKeyPem(String publicKeyPem);
|
||||||
|
|
||||||
boolean isVerifyEmail();
|
String getPrivateKeyPem();
|
||||||
|
|
||||||
void setVerifyEmail(boolean verifyEmail);
|
void setPrivateKeyPem(String privateKeyPem);
|
||||||
|
|
||||||
boolean isResetPasswordAllowed();
|
PublicKey getPublicKey();
|
||||||
|
|
||||||
void setResetPasswordAllowed(boolean resetPasswordAllowed);
|
void setPublicKey(PublicKey publicKey);
|
||||||
|
|
||||||
int getSsoSessionIdleTimeout();
|
String getCodeSecret();
|
||||||
|
|
||||||
void setSsoSessionIdleTimeout(int seconds);
|
Key getCodeSecretKey();
|
||||||
|
|
||||||
int getSsoSessionMaxLifespan();
|
void setCodeSecret(String codeSecret);
|
||||||
|
|
||||||
void setSsoSessionMaxLifespan(int seconds);
|
X509Certificate getCertificate();
|
||||||
|
void setCertificate(X509Certificate certificate);
|
||||||
|
String getCertificatePem();
|
||||||
|
void setCertificatePem(String certificate);
|
||||||
|
|
||||||
int getAccessTokenLifespan();
|
PrivateKey getPrivateKey();
|
||||||
|
|
||||||
void setAccessTokenLifespan(int seconds);
|
void setPrivateKey(PrivateKey privateKey);
|
||||||
|
|
||||||
int getAccessCodeLifespan();
|
List<RequiredCredentialModel> getRequiredCredentials();
|
||||||
|
|
||||||
void setAccessCodeLifespan(int seconds);
|
void addRequiredCredential(String cred);
|
||||||
|
|
||||||
int getAccessCodeLifespanUserAction();
|
PasswordPolicy getPasswordPolicy();
|
||||||
|
|
||||||
void setAccessCodeLifespanUserAction(int seconds);
|
void setPasswordPolicy(PasswordPolicy policy);
|
||||||
|
|
||||||
int getAccessCodeLifespanLogin();
|
RoleModel getRoleById(String id);
|
||||||
|
|
||||||
void setAccessCodeLifespanLogin(int seconds);
|
List<String> getDefaultRoles();
|
||||||
|
|
||||||
String getPublicKeyPem();
|
void addDefaultRole(String name);
|
||||||
|
|
||||||
void setPublicKeyPem(String publicKeyPem);
|
void updateDefaultRoles(String[] defaultRoles);
|
||||||
|
|
||||||
String getPrivateKeyPem();
|
ClientModel findClient(String clientId);
|
||||||
|
|
||||||
void setPrivateKeyPem(String privateKeyPem);
|
Map<String, ApplicationModel> getApplicationNameMap();
|
||||||
|
|
||||||
PublicKey getPublicKey();
|
List<ApplicationModel> getApplications();
|
||||||
|
|
||||||
void setPublicKey(PublicKey publicKey);
|
ApplicationModel addApplication(String name);
|
||||||
|
|
||||||
String getCodeSecret();
|
ApplicationModel addApplication(String id, String name);
|
||||||
|
|
||||||
Key getCodeSecretKey();
|
boolean removeApplication(String id);
|
||||||
|
|
||||||
void setCodeSecret(String codeSecret);
|
ApplicationModel getApplicationById(String id);
|
||||||
|
ApplicationModel getApplicationByName(String name);
|
||||||
|
|
||||||
X509Certificate getCertificate();
|
void updateRequiredCredentials(Set<String> creds);
|
||||||
|
|
||||||
void setCertificate(X509Certificate certificate);
|
OAuthClientModel addOAuthClient(String name);
|
||||||
|
|
||||||
String getCertificatePem();
|
OAuthClientModel addOAuthClient(String id, String name);
|
||||||
|
|
||||||
void setCertificatePem(String certificate);
|
OAuthClientModel getOAuthClient(String name);
|
||||||
|
OAuthClientModel getOAuthClientById(String id);
|
||||||
|
boolean removeOAuthClient(String id);
|
||||||
|
|
||||||
PrivateKey getPrivateKey();
|
List<OAuthClientModel> getOAuthClients();
|
||||||
|
|
||||||
void setPrivateKey(PrivateKey privateKey);
|
Map<String, String> getBrowserSecurityHeaders();
|
||||||
|
|
||||||
List<RequiredCredentialModel> getRequiredCredentials();
|
void setBrowserSecurityHeaders(Map<String, String> headers);
|
||||||
|
|
||||||
void addRequiredCredential(String cred);
|
Map<String, String> getSmtpConfig();
|
||||||
|
|
||||||
PasswordPolicy getPasswordPolicy();
|
void setSmtpConfig(Map<String, String> smtpConfig);
|
||||||
|
|
||||||
void setPasswordPolicy(PasswordPolicy policy);
|
List<IdentityProviderModel> getIdentityProviders();
|
||||||
|
|
||||||
RoleModel getRoleById(String id);
|
IdentityProviderModel getIdentityProviderById(String identityProviderId);
|
||||||
|
|
||||||
List<String> getDefaultRoles();
|
void addIdentityProvider(IdentityProviderModel identityProvider);
|
||||||
|
|
||||||
void addDefaultRole(String name);
|
void removeIdentityProviderById(String providerId);
|
||||||
|
|
||||||
void updateDefaultRoles(String[] defaultRoles);
|
void updateIdentityProvider(IdentityProviderModel identityProvider);
|
||||||
|
|
||||||
ClientModel findClient(String clientId);
|
List<UserFederationProviderModel> getUserFederationProviders();
|
||||||
|
|
||||||
Map<String, ApplicationModel> getApplicationNameMap();
|
UserFederationProviderModel addUserFederationProvider(String providerName, Map<String, String> config, int priority,
|
||||||
|
String displayName, int fullSyncPeriod, int changedSyncPeriod, int lastSync);
|
||||||
|
|
||||||
List<ApplicationModel> getApplications();
|
void updateUserFederationProvider(UserFederationProviderModel provider);
|
||||||
|
|
||||||
ApplicationModel addApplication(String name);
|
void removeUserFederationProvider(UserFederationProviderModel provider);
|
||||||
|
|
||||||
ApplicationModel addApplication(String id, String name);
|
void setUserFederationProviders(List<UserFederationProviderModel> providers);
|
||||||
|
|
||||||
boolean removeApplication(String id);
|
String getLoginTheme();
|
||||||
|
|
||||||
ApplicationModel getApplicationById(String id);
|
void setLoginTheme(String name);
|
||||||
|
|
||||||
ApplicationModel getApplicationByName(String name);
|
String getAccountTheme();
|
||||||
|
|
||||||
void updateRequiredCredentials(Set<String> creds);
|
void setAccountTheme(String name);
|
||||||
|
|
||||||
OAuthClientModel addOAuthClient(String name);
|
String getAdminTheme();
|
||||||
|
|
||||||
OAuthClientModel addOAuthClient(String id, String name);
|
void setAdminTheme(String name);
|
||||||
|
|
||||||
OAuthClientModel getOAuthClient(String name);
|
String getEmailTheme();
|
||||||
|
|
||||||
OAuthClientModel getOAuthClientById(String id);
|
void setEmailTheme(String name);
|
||||||
|
|
||||||
boolean removeOAuthClient(String id);
|
/**
|
||||||
|
* Time in seconds since epoc
|
||||||
|
*
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
int getNotBefore();
|
||||||
|
|
||||||
List<OAuthClientModel> getOAuthClients();
|
void setNotBefore(int notBefore);
|
||||||
|
|
||||||
Map<String, String> getBrowserSecurityHeaders();
|
boolean removeRoleById(String id);
|
||||||
|
|
||||||
void setBrowserSecurityHeaders(Map<String, String> headers);
|
boolean isEventsEnabled();
|
||||||
|
|
||||||
Map<String, String> getSmtpConfig();
|
void setEventsEnabled(boolean enabled);
|
||||||
|
|
||||||
void setSmtpConfig(Map<String, String> smtpConfig);
|
long getEventsExpiration();
|
||||||
|
|
||||||
List<IdentityProviderModel> getIdentityProviders();
|
void setEventsExpiration(long expiration);
|
||||||
|
|
||||||
IdentityProviderModel getIdentityProviderById(String identityProviderId);
|
Set<String> getEventsListeners();
|
||||||
|
|
||||||
void addIdentityProvider(IdentityProviderModel identityProvider);
|
void setEventsListeners(Set<String> listeners);
|
||||||
|
|
||||||
void removeIdentityProviderById(String providerId);
|
ApplicationModel getMasterAdminApp();
|
||||||
|
|
||||||
void updateIdentityProvider(IdentityProviderModel identityProvider);
|
void setMasterAdminApp(ApplicationModel app);
|
||||||
|
|
||||||
List<UserFederationProviderModel> getUserFederationProviders();
|
ClientModel findClientById(String id);
|
||||||
|
|
||||||
UserFederationProviderModel addUserFederationProvider(String providerName, Map<String, String> config, int priority,
|
boolean isIdentityFederationEnabled();
|
||||||
String displayName, int fullSyncPeriod, int changedSyncPeriod, int lastSync);
|
|
||||||
|
|
||||||
void updateUserFederationProvider(UserFederationProviderModel provider);
|
|
||||||
|
|
||||||
void removeUserFederationProvider(UserFederationProviderModel provider);
|
|
||||||
|
|
||||||
void setUserFederationProviders(List<UserFederationProviderModel> providers);
|
|
||||||
|
|
||||||
String getLoginTheme();
|
|
||||||
|
|
||||||
void setLoginTheme(String name);
|
|
||||||
|
|
||||||
String getAccountTheme();
|
|
||||||
|
|
||||||
void setAccountTheme(String name);
|
|
||||||
|
|
||||||
String getAdminTheme();
|
|
||||||
|
|
||||||
void setAdminTheme(String name);
|
|
||||||
|
|
||||||
String getEmailTheme();
|
|
||||||
|
|
||||||
void setEmailTheme(String name);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Time in seconds since epoc
|
|
||||||
*
|
|
||||||
* @return
|
|
||||||
*/
|
|
||||||
int getNotBefore();
|
|
||||||
|
|
||||||
void setNotBefore(int notBefore);
|
|
||||||
|
|
||||||
boolean removeRoleById(String id);
|
|
||||||
|
|
||||||
boolean isEventsEnabled();
|
|
||||||
|
|
||||||
void setEventsEnabled(boolean enabled);
|
|
||||||
|
|
||||||
long getEventsExpiration();
|
|
||||||
|
|
||||||
void setEventsExpiration(long expiration);
|
|
||||||
|
|
||||||
Set<String> getEventsListeners();
|
|
||||||
|
|
||||||
void setEventsListeners(Set<String> listeners);
|
|
||||||
|
|
||||||
ApplicationModel getMasterAdminApp();
|
|
||||||
|
|
||||||
void setMasterAdminApp(ApplicationModel app);
|
|
||||||
|
|
||||||
ClientModel findClientById(String id);
|
|
||||||
|
|
||||||
boolean isIdentityFederationEnabled();
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -10,402 +10,402 @@ import java.util.Map;
|
||||||
*/
|
*/
|
||||||
public class RealmEntity extends AbstractIdentifiableEntity {
|
public class RealmEntity extends AbstractIdentifiableEntity {
|
||||||
|
|
||||||
private String name;
|
private String name;
|
||||||
private boolean enabled;
|
private boolean enabled;
|
||||||
private String sslRequired;
|
private String sslRequired;
|
||||||
private boolean registrationAllowed;
|
private boolean registrationAllowed;
|
||||||
protected boolean registrationEmailAsUsername;
|
protected boolean registrationEmailAsUsername;
|
||||||
private boolean rememberMe;
|
private boolean rememberMe;
|
||||||
private boolean verifyEmail;
|
private boolean verifyEmail;
|
||||||
private boolean passwordCredentialGrantAllowed;
|
private boolean passwordCredentialGrantAllowed;
|
||||||
private boolean resetPasswordAllowed;
|
private boolean resetPasswordAllowed;
|
||||||
private String passwordPolicy;
|
private String passwordPolicy;
|
||||||
// --- brute force settings
|
// --- brute force settings
|
||||||
private boolean bruteForceProtected;
|
private boolean bruteForceProtected;
|
||||||
private int maxFailureWaitSeconds;
|
private int maxFailureWaitSeconds;
|
||||||
private int minimumQuickLoginWaitSeconds;
|
private int minimumQuickLoginWaitSeconds;
|
||||||
private int waitIncrementSeconds;
|
private int waitIncrementSeconds;
|
||||||
private long quickLoginCheckMilliSeconds;
|
private long quickLoginCheckMilliSeconds;
|
||||||
private int maxDeltaTimeSeconds;
|
private int maxDeltaTimeSeconds;
|
||||||
private int failureFactor;
|
private int failureFactor;
|
||||||
// --- end brute force settings
|
// --- end brute force settings
|
||||||
|
|
||||||
private int ssoSessionIdleTimeout;
|
private int ssoSessionIdleTimeout;
|
||||||
private int ssoSessionMaxLifespan;
|
private int ssoSessionMaxLifespan;
|
||||||
private int accessTokenLifespan;
|
private int accessTokenLifespan;
|
||||||
private int accessCodeLifespan;
|
private int accessCodeLifespan;
|
||||||
private int accessCodeLifespanUserAction;
|
private int accessCodeLifespanUserAction;
|
||||||
private int accessCodeLifespanLogin;
|
private int accessCodeLifespanLogin;
|
||||||
private int notBefore;
|
private int notBefore;
|
||||||
|
|
||||||
private String publicKeyPem;
|
private String publicKeyPem;
|
||||||
private String privateKeyPem;
|
private String privateKeyPem;
|
||||||
private String certificatePem;
|
private String certificatePem;
|
||||||
private String codeSecret;
|
private String codeSecret;
|
||||||
|
|
||||||
private String loginTheme;
|
private String loginTheme;
|
||||||
private String accountTheme;
|
private String accountTheme;
|
||||||
private String adminTheme;
|
private String adminTheme;
|
||||||
private String emailTheme;
|
private String emailTheme;
|
||||||
|
|
||||||
// We are using names of defaultRoles (not ids)
|
// We are using names of defaultRoles (not ids)
|
||||||
private List<String> defaultRoles = new ArrayList<String>();
|
private List<String> defaultRoles = new ArrayList<String>();
|
||||||
|
|
||||||
private List<RequiredCredentialEntity> requiredCredentials = new ArrayList<RequiredCredentialEntity>();
|
private List<RequiredCredentialEntity> requiredCredentials = new ArrayList<RequiredCredentialEntity>();
|
||||||
private List<UserFederationProviderEntity> userFederationProviders = new ArrayList<UserFederationProviderEntity>();
|
private List<UserFederationProviderEntity> userFederationProviders = new ArrayList<UserFederationProviderEntity>();
|
||||||
private List<IdentityProviderEntity> identityProviders = new ArrayList<IdentityProviderEntity>();
|
private List<IdentityProviderEntity> identityProviders = new ArrayList<IdentityProviderEntity>();
|
||||||
|
|
||||||
private Map<String, String> browserSecurityHeaders = new HashMap<String, String>();
|
private Map<String, String> browserSecurityHeaders = new HashMap<String, String>();
|
||||||
private Map<String, String> smtpConfig = new HashMap<String, String>();
|
private Map<String, String> smtpConfig = new HashMap<String, String>();
|
||||||
private Map<String, String> socialConfig = new HashMap<String, String>();
|
private Map<String, String> socialConfig = new HashMap<String, String>();
|
||||||
|
|
||||||
private boolean eventsEnabled;
|
private boolean eventsEnabled;
|
||||||
private long eventsExpiration;
|
private long eventsExpiration;
|
||||||
private List<String> eventsListeners = new ArrayList<String>();
|
private List<String> eventsListeners = new ArrayList<String>();
|
||||||
|
|
||||||
private String adminAppId;
|
private String adminAppId;
|
||||||
|
|
||||||
public String getName() {
|
public String getName() {
|
||||||
return name;
|
return name;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setName(String name) {
|
public void setName(String name) {
|
||||||
this.name = name;
|
this.name = name;
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean isEnabled() {
|
public boolean isEnabled() {
|
||||||
return enabled;
|
return enabled;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setEnabled(boolean enabled) {
|
public void setEnabled(boolean enabled) {
|
||||||
this.enabled = enabled;
|
this.enabled = enabled;
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getSslRequired() {
|
public String getSslRequired() {
|
||||||
return sslRequired;
|
return sslRequired;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setSslRequired(String sslRequired) {
|
public void setSslRequired(String sslRequired) {
|
||||||
this.sslRequired = sslRequired;
|
this.sslRequired = sslRequired;
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean isPasswordCredentialGrantAllowed() {
|
public boolean isPasswordCredentialGrantAllowed() {
|
||||||
return passwordCredentialGrantAllowed;
|
return passwordCredentialGrantAllowed;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setPasswordCredentialGrantAllowed(boolean passwordCredentialGrantAllowed) {
|
public void setPasswordCredentialGrantAllowed(boolean passwordCredentialGrantAllowed) {
|
||||||
this.passwordCredentialGrantAllowed = passwordCredentialGrantAllowed;
|
this.passwordCredentialGrantAllowed = passwordCredentialGrantAllowed;
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean isRegistrationAllowed() {
|
public boolean isRegistrationAllowed() {
|
||||||
return registrationAllowed;
|
return registrationAllowed;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setRegistrationAllowed(boolean registrationAllowed) {
|
public void setRegistrationAllowed(boolean registrationAllowed) {
|
||||||
this.registrationAllowed = registrationAllowed;
|
this.registrationAllowed = registrationAllowed;
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean isRegistrationEmailAsUsername() {
|
public boolean isRegistrationEmailAsUsername() {
|
||||||
return registrationEmailAsUsername;
|
return registrationEmailAsUsername;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setRegistrationEmailAsUsername(boolean registrationEmailAsUsername) {
|
public void setRegistrationEmailAsUsername(boolean registrationEmailAsUsername) {
|
||||||
this.registrationEmailAsUsername = registrationEmailAsUsername;
|
this.registrationEmailAsUsername = registrationEmailAsUsername;
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean isRememberMe() {
|
public boolean isRememberMe() {
|
||||||
return rememberMe;
|
return rememberMe;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setRememberMe(boolean rememberMe) {
|
public void setRememberMe(boolean rememberMe) {
|
||||||
this.rememberMe = rememberMe;
|
this.rememberMe = rememberMe;
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean isVerifyEmail() {
|
public boolean isVerifyEmail() {
|
||||||
return verifyEmail;
|
return verifyEmail;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setVerifyEmail(boolean verifyEmail) {
|
public void setVerifyEmail(boolean verifyEmail) {
|
||||||
this.verifyEmail = verifyEmail;
|
this.verifyEmail = verifyEmail;
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean isResetPasswordAllowed() {
|
public boolean isResetPasswordAllowed() {
|
||||||
return resetPasswordAllowed;
|
return resetPasswordAllowed;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setResetPasswordAllowed(boolean resetPasswordAllowed) {
|
public void setResetPasswordAllowed(boolean resetPasswordAllowed) {
|
||||||
this.resetPasswordAllowed = resetPasswordAllowed;
|
this.resetPasswordAllowed = resetPasswordAllowed;
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getPasswordPolicy() {
|
public String getPasswordPolicy() {
|
||||||
return passwordPolicy;
|
return passwordPolicy;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setPasswordPolicy(String passwordPolicy) {
|
public void setPasswordPolicy(String passwordPolicy) {
|
||||||
this.passwordPolicy = passwordPolicy;
|
this.passwordPolicy = passwordPolicy;
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean isBruteForceProtected() {
|
public boolean isBruteForceProtected() {
|
||||||
return bruteForceProtected;
|
return bruteForceProtected;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setBruteForceProtected(boolean bruteForceProtected) {
|
public void setBruteForceProtected(boolean bruteForceProtected) {
|
||||||
this.bruteForceProtected = bruteForceProtected;
|
this.bruteForceProtected = bruteForceProtected;
|
||||||
}
|
}
|
||||||
|
|
||||||
public int getMaxFailureWaitSeconds() {
|
public int getMaxFailureWaitSeconds() {
|
||||||
return maxFailureWaitSeconds;
|
return maxFailureWaitSeconds;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setMaxFailureWaitSeconds(int maxFailureWaitSeconds) {
|
public void setMaxFailureWaitSeconds(int maxFailureWaitSeconds) {
|
||||||
this.maxFailureWaitSeconds = maxFailureWaitSeconds;
|
this.maxFailureWaitSeconds = maxFailureWaitSeconds;
|
||||||
}
|
}
|
||||||
|
|
||||||
public int getMinimumQuickLoginWaitSeconds() {
|
public int getMinimumQuickLoginWaitSeconds() {
|
||||||
return minimumQuickLoginWaitSeconds;
|
return minimumQuickLoginWaitSeconds;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setMinimumQuickLoginWaitSeconds(int minimumQuickLoginWaitSeconds) {
|
public void setMinimumQuickLoginWaitSeconds(int minimumQuickLoginWaitSeconds) {
|
||||||
this.minimumQuickLoginWaitSeconds = minimumQuickLoginWaitSeconds;
|
this.minimumQuickLoginWaitSeconds = minimumQuickLoginWaitSeconds;
|
||||||
}
|
}
|
||||||
|
|
||||||
public int getWaitIncrementSeconds() {
|
public int getWaitIncrementSeconds() {
|
||||||
return waitIncrementSeconds;
|
return waitIncrementSeconds;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setWaitIncrementSeconds(int waitIncrementSeconds) {
|
public void setWaitIncrementSeconds(int waitIncrementSeconds) {
|
||||||
this.waitIncrementSeconds = waitIncrementSeconds;
|
this.waitIncrementSeconds = waitIncrementSeconds;
|
||||||
}
|
}
|
||||||
|
|
||||||
public long getQuickLoginCheckMilliSeconds() {
|
public long getQuickLoginCheckMilliSeconds() {
|
||||||
return quickLoginCheckMilliSeconds;
|
return quickLoginCheckMilliSeconds;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setQuickLoginCheckMilliSeconds(long quickLoginCheckMilliSeconds) {
|
public void setQuickLoginCheckMilliSeconds(long quickLoginCheckMilliSeconds) {
|
||||||
this.quickLoginCheckMilliSeconds = quickLoginCheckMilliSeconds;
|
this.quickLoginCheckMilliSeconds = quickLoginCheckMilliSeconds;
|
||||||
}
|
}
|
||||||
|
|
||||||
public int getMaxDeltaTimeSeconds() {
|
public int getMaxDeltaTimeSeconds() {
|
||||||
return maxDeltaTimeSeconds;
|
return maxDeltaTimeSeconds;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setMaxDeltaTimeSeconds(int maxDeltaTimeSeconds) {
|
public void setMaxDeltaTimeSeconds(int maxDeltaTimeSeconds) {
|
||||||
this.maxDeltaTimeSeconds = maxDeltaTimeSeconds;
|
this.maxDeltaTimeSeconds = maxDeltaTimeSeconds;
|
||||||
}
|
}
|
||||||
|
|
||||||
public int getFailureFactor() {
|
public int getFailureFactor() {
|
||||||
return failureFactor;
|
return failureFactor;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setFailureFactor(int failureFactor) {
|
public void setFailureFactor(int failureFactor) {
|
||||||
this.failureFactor = failureFactor;
|
this.failureFactor = failureFactor;
|
||||||
}
|
}
|
||||||
|
|
||||||
public int getSsoSessionIdleTimeout() {
|
public int getSsoSessionIdleTimeout() {
|
||||||
return ssoSessionIdleTimeout;
|
return ssoSessionIdleTimeout;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setSsoSessionIdleTimeout(int ssoSessionIdleTimeout) {
|
public void setSsoSessionIdleTimeout(int ssoSessionIdleTimeout) {
|
||||||
this.ssoSessionIdleTimeout = ssoSessionIdleTimeout;
|
this.ssoSessionIdleTimeout = ssoSessionIdleTimeout;
|
||||||
}
|
}
|
||||||
|
|
||||||
public int getSsoSessionMaxLifespan() {
|
public int getSsoSessionMaxLifespan() {
|
||||||
return ssoSessionMaxLifespan;
|
return ssoSessionMaxLifespan;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setSsoSessionMaxLifespan(int ssoSessionMaxLifespan) {
|
public void setSsoSessionMaxLifespan(int ssoSessionMaxLifespan) {
|
||||||
this.ssoSessionMaxLifespan = ssoSessionMaxLifespan;
|
this.ssoSessionMaxLifespan = ssoSessionMaxLifespan;
|
||||||
}
|
}
|
||||||
|
|
||||||
public int getAccessTokenLifespan() {
|
public int getAccessTokenLifespan() {
|
||||||
return accessTokenLifespan;
|
return accessTokenLifespan;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setAccessTokenLifespan(int accessTokenLifespan) {
|
public void setAccessTokenLifespan(int accessTokenLifespan) {
|
||||||
this.accessTokenLifespan = accessTokenLifespan;
|
this.accessTokenLifespan = accessTokenLifespan;
|
||||||
}
|
}
|
||||||
|
|
||||||
public int getAccessCodeLifespan() {
|
public int getAccessCodeLifespan() {
|
||||||
return accessCodeLifespan;
|
return accessCodeLifespan;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setAccessCodeLifespan(int accessCodeLifespan) {
|
public void setAccessCodeLifespan(int accessCodeLifespan) {
|
||||||
this.accessCodeLifespan = accessCodeLifespan;
|
this.accessCodeLifespan = accessCodeLifespan;
|
||||||
}
|
}
|
||||||
|
|
||||||
public int getAccessCodeLifespanUserAction() {
|
public int getAccessCodeLifespanUserAction() {
|
||||||
return accessCodeLifespanUserAction;
|
return accessCodeLifespanUserAction;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setAccessCodeLifespanUserAction(int accessCodeLifespanUserAction) {
|
public void setAccessCodeLifespanUserAction(int accessCodeLifespanUserAction) {
|
||||||
this.accessCodeLifespanUserAction = accessCodeLifespanUserAction;
|
this.accessCodeLifespanUserAction = accessCodeLifespanUserAction;
|
||||||
}
|
}
|
||||||
|
|
||||||
public int getAccessCodeLifespanLogin() {
|
public int getAccessCodeLifespanLogin() {
|
||||||
return accessCodeLifespanLogin;
|
return accessCodeLifespanLogin;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setAccessCodeLifespanLogin(int accessCodeLifespanLogin) {
|
public void setAccessCodeLifespanLogin(int accessCodeLifespanLogin) {
|
||||||
this.accessCodeLifespanLogin = accessCodeLifespanLogin;
|
this.accessCodeLifespanLogin = accessCodeLifespanLogin;
|
||||||
}
|
}
|
||||||
|
|
||||||
public int getNotBefore() {
|
public int getNotBefore() {
|
||||||
return notBefore;
|
return notBefore;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setNotBefore(int notBefore) {
|
public void setNotBefore(int notBefore) {
|
||||||
this.notBefore = notBefore;
|
this.notBefore = notBefore;
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getPublicKeyPem() {
|
public String getPublicKeyPem() {
|
||||||
return publicKeyPem;
|
return publicKeyPem;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setPublicKeyPem(String publicKeyPem) {
|
public void setPublicKeyPem(String publicKeyPem) {
|
||||||
this.publicKeyPem = publicKeyPem;
|
this.publicKeyPem = publicKeyPem;
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getPrivateKeyPem() {
|
public String getPrivateKeyPem() {
|
||||||
return privateKeyPem;
|
return privateKeyPem;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setPrivateKeyPem(String privateKeyPem) {
|
public void setPrivateKeyPem(String privateKeyPem) {
|
||||||
this.privateKeyPem = privateKeyPem;
|
this.privateKeyPem = privateKeyPem;
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getCodeSecret() {
|
public String getCodeSecret() {
|
||||||
return codeSecret;
|
return codeSecret;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setCodeSecret(String codeSecret) {
|
public void setCodeSecret(String codeSecret) {
|
||||||
this.codeSecret = codeSecret;
|
this.codeSecret = codeSecret;
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getLoginTheme() {
|
public String getLoginTheme() {
|
||||||
return loginTheme;
|
return loginTheme;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setLoginTheme(String loginTheme) {
|
public void setLoginTheme(String loginTheme) {
|
||||||
this.loginTheme = loginTheme;
|
this.loginTheme = loginTheme;
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getAccountTheme() {
|
public String getAccountTheme() {
|
||||||
return accountTheme;
|
return accountTheme;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setAccountTheme(String accountTheme) {
|
public void setAccountTheme(String accountTheme) {
|
||||||
this.accountTheme = accountTheme;
|
this.accountTheme = accountTheme;
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getAdminTheme() {
|
public String getAdminTheme() {
|
||||||
return adminTheme;
|
return adminTheme;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setAdminTheme(String adminTheme) {
|
public void setAdminTheme(String adminTheme) {
|
||||||
this.adminTheme = adminTheme;
|
this.adminTheme = adminTheme;
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getEmailTheme() {
|
public String getEmailTheme() {
|
||||||
return emailTheme;
|
return emailTheme;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setEmailTheme(String emailTheme) {
|
public void setEmailTheme(String emailTheme) {
|
||||||
this.emailTheme = emailTheme;
|
this.emailTheme = emailTheme;
|
||||||
}
|
}
|
||||||
|
|
||||||
public List<String> getDefaultRoles() {
|
public List<String> getDefaultRoles() {
|
||||||
return defaultRoles;
|
return defaultRoles;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setDefaultRoles(List<String> defaultRoles) {
|
public void setDefaultRoles(List<String> defaultRoles) {
|
||||||
this.defaultRoles = defaultRoles;
|
this.defaultRoles = defaultRoles;
|
||||||
}
|
}
|
||||||
|
|
||||||
public List<RequiredCredentialEntity> getRequiredCredentials() {
|
public List<RequiredCredentialEntity> getRequiredCredentials() {
|
||||||
return requiredCredentials;
|
return requiredCredentials;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setRequiredCredentials(List<RequiredCredentialEntity> requiredCredentials) {
|
public void setRequiredCredentials(List<RequiredCredentialEntity> requiredCredentials) {
|
||||||
this.requiredCredentials = requiredCredentials;
|
this.requiredCredentials = requiredCredentials;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Map<String, String> getBrowserSecurityHeaders() {
|
public Map<String, String> getBrowserSecurityHeaders() {
|
||||||
return browserSecurityHeaders;
|
return browserSecurityHeaders;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setBrowserSecurityHeaders(Map<String, String> browserSecurityHeaders) {
|
public void setBrowserSecurityHeaders(Map<String, String> browserSecurityHeaders) {
|
||||||
this.browserSecurityHeaders = browserSecurityHeaders;
|
this.browserSecurityHeaders = browserSecurityHeaders;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Map<String, String> getSmtpConfig() {
|
public Map<String, String> getSmtpConfig() {
|
||||||
return smtpConfig;
|
return smtpConfig;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setSmtpConfig(Map<String, String> smtpConfig) {
|
public void setSmtpConfig(Map<String, String> smtpConfig) {
|
||||||
this.smtpConfig = smtpConfig;
|
this.smtpConfig = smtpConfig;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Map<String, String> getSocialConfig() {
|
public Map<String, String> getSocialConfig() {
|
||||||
return socialConfig;
|
return socialConfig;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setSocialConfig(Map<String, String> socialConfig) {
|
public void setSocialConfig(Map<String, String> socialConfig) {
|
||||||
this.socialConfig = socialConfig;
|
this.socialConfig = socialConfig;
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean isEventsEnabled() {
|
public boolean isEventsEnabled() {
|
||||||
return eventsEnabled;
|
return eventsEnabled;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setEventsEnabled(boolean eventsEnabled) {
|
public void setEventsEnabled(boolean eventsEnabled) {
|
||||||
this.eventsEnabled = eventsEnabled;
|
this.eventsEnabled = eventsEnabled;
|
||||||
}
|
}
|
||||||
|
|
||||||
public long getEventsExpiration() {
|
public long getEventsExpiration() {
|
||||||
return eventsExpiration;
|
return eventsExpiration;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setEventsExpiration(long eventsExpiration) {
|
public void setEventsExpiration(long eventsExpiration) {
|
||||||
this.eventsExpiration = eventsExpiration;
|
this.eventsExpiration = eventsExpiration;
|
||||||
}
|
}
|
||||||
|
|
||||||
public List<String> getEventsListeners() {
|
public List<String> getEventsListeners() {
|
||||||
return eventsListeners;
|
return eventsListeners;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setEventsListeners(List<String> eventsListeners) {
|
public void setEventsListeners(List<String> eventsListeners) {
|
||||||
this.eventsListeners = eventsListeners;
|
this.eventsListeners = eventsListeners;
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getAdminAppId() {
|
public String getAdminAppId() {
|
||||||
return adminAppId;
|
return adminAppId;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setAdminAppId(String adminAppId) {
|
public void setAdminAppId(String adminAppId) {
|
||||||
this.adminAppId = adminAppId;
|
this.adminAppId = adminAppId;
|
||||||
}
|
}
|
||||||
|
|
||||||
public List<UserFederationProviderEntity> getUserFederationProviders() {
|
public List<UserFederationProviderEntity> getUserFederationProviders() {
|
||||||
return userFederationProviders;
|
return userFederationProviders;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setUserFederationProviders(List<UserFederationProviderEntity> userFederationProviders) {
|
public void setUserFederationProviders(List<UserFederationProviderEntity> userFederationProviders) {
|
||||||
this.userFederationProviders = userFederationProviders;
|
this.userFederationProviders = userFederationProviders;
|
||||||
}
|
}
|
||||||
|
|
||||||
public List<IdentityProviderEntity> getIdentityProviders() {
|
public List<IdentityProviderEntity> getIdentityProviders() {
|
||||||
return identityProviders;
|
return identityProviders;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setIdentityProviders(List<IdentityProviderEntity> identityProviders) {
|
public void setIdentityProviders(List<IdentityProviderEntity> identityProviders) {
|
||||||
this.identityProviders = identityProviders;
|
this.identityProviders = identityProviders;
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getCertificatePem() {
|
public String getCertificatePem() {
|
||||||
return certificatePem;
|
return certificatePem;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setCertificatePem(String certificatePem) {
|
public void setCertificatePem(String certificatePem) {
|
||||||
this.certificatePem = certificatePem;
|
this.certificatePem = certificatePem;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -44,326 +44,326 @@ import org.keycloak.representations.idm.UserSessionRepresentation;
|
||||||
* @version $Revision: 1 $
|
* @version $Revision: 1 $
|
||||||
*/
|
*/
|
||||||
public class ModelToRepresentation {
|
public class ModelToRepresentation {
|
||||||
public static UserRepresentation toRepresentation(UserModel user) {
|
public static UserRepresentation toRepresentation(UserModel user) {
|
||||||
UserRepresentation rep = new UserRepresentation();
|
UserRepresentation rep = new UserRepresentation();
|
||||||
rep.setId(user.getId());
|
rep.setId(user.getId());
|
||||||
rep.setUsername(user.getUsername());
|
rep.setUsername(user.getUsername());
|
||||||
rep.setLastName(user.getLastName());
|
rep.setLastName(user.getLastName());
|
||||||
rep.setFirstName(user.getFirstName());
|
rep.setFirstName(user.getFirstName());
|
||||||
rep.setEmail(user.getEmail());
|
rep.setEmail(user.getEmail());
|
||||||
rep.setEnabled(user.isEnabled());
|
rep.setEnabled(user.isEnabled());
|
||||||
rep.setEmailVerified(user.isEmailVerified());
|
rep.setEmailVerified(user.isEmailVerified());
|
||||||
rep.setTotp(user.isTotp());
|
rep.setTotp(user.isTotp());
|
||||||
rep.setFederationLink(user.getFederationLink());
|
rep.setFederationLink(user.getFederationLink());
|
||||||
|
|
||||||
List<String> reqActions = new ArrayList<String>();
|
List<String> reqActions = new ArrayList<String>();
|
||||||
for (UserModel.RequiredAction ra : user.getRequiredActions()) {
|
for (UserModel.RequiredAction ra : user.getRequiredActions()) {
|
||||||
reqActions.add(ra.name());
|
reqActions.add(ra.name());
|
||||||
}
|
}
|
||||||
|
|
||||||
rep.setRequiredActions(reqActions);
|
rep.setRequiredActions(reqActions);
|
||||||
|
|
||||||
if (user.getAttributes() != null && !user.getAttributes().isEmpty()) {
|
if (user.getAttributes() != null && !user.getAttributes().isEmpty()) {
|
||||||
Map<String, String> attrs = new HashMap<String, String>();
|
Map<String, String> attrs = new HashMap<String, String>();
|
||||||
attrs.putAll(user.getAttributes());
|
attrs.putAll(user.getAttributes());
|
||||||
rep.setAttributes(attrs);
|
rep.setAttributes(attrs);
|
||||||
}
|
}
|
||||||
return rep;
|
return rep;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static RoleRepresentation toRepresentation(RoleModel role) {
|
public static RoleRepresentation toRepresentation(RoleModel role) {
|
||||||
RoleRepresentation rep = new RoleRepresentation();
|
RoleRepresentation rep = new RoleRepresentation();
|
||||||
rep.setId(role.getId());
|
rep.setId(role.getId());
|
||||||
rep.setName(role.getName());
|
rep.setName(role.getName());
|
||||||
rep.setDescription(role.getDescription());
|
rep.setDescription(role.getDescription());
|
||||||
rep.setComposite(role.isComposite());
|
rep.setComposite(role.isComposite());
|
||||||
return rep;
|
return rep;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static RealmRepresentation toRepresentation(RealmModel realm, boolean internal) {
|
public static RealmRepresentation toRepresentation(RealmModel realm, boolean internal) {
|
||||||
RealmRepresentation rep = new RealmRepresentation();
|
RealmRepresentation rep = new RealmRepresentation();
|
||||||
rep.setId(realm.getId());
|
rep.setId(realm.getId());
|
||||||
rep.setRealm(realm.getName());
|
rep.setRealm(realm.getName());
|
||||||
rep.setEnabled(realm.isEnabled());
|
rep.setEnabled(realm.isEnabled());
|
||||||
rep.setNotBefore(realm.getNotBefore());
|
rep.setNotBefore(realm.getNotBefore());
|
||||||
rep.setSslRequired(realm.getSslRequired().name().toLowerCase());
|
rep.setSslRequired(realm.getSslRequired().name().toLowerCase());
|
||||||
rep.setPublicKey(realm.getPublicKeyPem());
|
rep.setPublicKey(realm.getPublicKeyPem());
|
||||||
if (internal) {
|
if (internal) {
|
||||||
rep.setPrivateKey(realm.getPrivateKeyPem());
|
rep.setPrivateKey(realm.getPrivateKeyPem());
|
||||||
String privateKeyPem = realm.getPrivateKeyPem();
|
String privateKeyPem = realm.getPrivateKeyPem();
|
||||||
if (realm.getCertificatePem() == null && privateKeyPem != null) {
|
if (realm.getCertificatePem() == null && privateKeyPem != null) {
|
||||||
KeycloakModelUtils.generateRealmCertificate(realm);
|
KeycloakModelUtils.generateRealmCertificate(realm);
|
||||||
}
|
}
|
||||||
rep.setCodeSecret(realm.getCodeSecret());
|
rep.setCodeSecret(realm.getCodeSecret());
|
||||||
}
|
}
|
||||||
rep.setCertificate(realm.getCertificatePem());
|
rep.setCertificate(realm.getCertificatePem());
|
||||||
rep.setPasswordCredentialGrantAllowed(realm.isPasswordCredentialGrantAllowed());
|
rep.setPasswordCredentialGrantAllowed(realm.isPasswordCredentialGrantAllowed());
|
||||||
rep.setRegistrationAllowed(realm.isRegistrationAllowed());
|
rep.setRegistrationAllowed(realm.isRegistrationAllowed());
|
||||||
rep.setRegistrationEmailAsUsername(realm.isRegistrationEmailAsUsername());
|
rep.setRegistrationEmailAsUsername(realm.isRegistrationEmailAsUsername());
|
||||||
rep.setRememberMe(realm.isRememberMe());
|
rep.setRememberMe(realm.isRememberMe());
|
||||||
rep.setBruteForceProtected(realm.isBruteForceProtected());
|
rep.setBruteForceProtected(realm.isBruteForceProtected());
|
||||||
rep.setMaxFailureWaitSeconds(realm.getMaxFailureWaitSeconds());
|
rep.setMaxFailureWaitSeconds(realm.getMaxFailureWaitSeconds());
|
||||||
rep.setMinimumQuickLoginWaitSeconds(realm.getMinimumQuickLoginWaitSeconds());
|
rep.setMinimumQuickLoginWaitSeconds(realm.getMinimumQuickLoginWaitSeconds());
|
||||||
rep.setWaitIncrementSeconds(realm.getWaitIncrementSeconds());
|
rep.setWaitIncrementSeconds(realm.getWaitIncrementSeconds());
|
||||||
rep.setQuickLoginCheckMilliSeconds(realm.getQuickLoginCheckMilliSeconds());
|
rep.setQuickLoginCheckMilliSeconds(realm.getQuickLoginCheckMilliSeconds());
|
||||||
rep.setMaxDeltaTimeSeconds(realm.getMaxDeltaTimeSeconds());
|
rep.setMaxDeltaTimeSeconds(realm.getMaxDeltaTimeSeconds());
|
||||||
rep.setFailureFactor(realm.getFailureFactor());
|
rep.setFailureFactor(realm.getFailureFactor());
|
||||||
rep.setVerifyEmail(realm.isVerifyEmail());
|
rep.setVerifyEmail(realm.isVerifyEmail());
|
||||||
rep.setResetPasswordAllowed(realm.isResetPasswordAllowed());
|
rep.setResetPasswordAllowed(realm.isResetPasswordAllowed());
|
||||||
rep.setAccessTokenLifespan(realm.getAccessTokenLifespan());
|
rep.setAccessTokenLifespan(realm.getAccessTokenLifespan());
|
||||||
rep.setSsoSessionIdleTimeout(realm.getSsoSessionIdleTimeout());
|
rep.setSsoSessionIdleTimeout(realm.getSsoSessionIdleTimeout());
|
||||||
rep.setSsoSessionMaxLifespan(realm.getSsoSessionMaxLifespan());
|
rep.setSsoSessionMaxLifespan(realm.getSsoSessionMaxLifespan());
|
||||||
rep.setAccessCodeLifespan(realm.getAccessCodeLifespan());
|
rep.setAccessCodeLifespan(realm.getAccessCodeLifespan());
|
||||||
rep.setAccessCodeLifespanUserAction(realm.getAccessCodeLifespanUserAction());
|
rep.setAccessCodeLifespanUserAction(realm.getAccessCodeLifespanUserAction());
|
||||||
rep.setAccessCodeLifespanLogin(realm.getAccessCodeLifespanLogin());
|
rep.setAccessCodeLifespanLogin(realm.getAccessCodeLifespanLogin());
|
||||||
rep.setSmtpServer(realm.getSmtpConfig());
|
rep.setSmtpServer(realm.getSmtpConfig());
|
||||||
rep.setBrowserSecurityHeaders(realm.getBrowserSecurityHeaders());
|
rep.setBrowserSecurityHeaders(realm.getBrowserSecurityHeaders());
|
||||||
rep.setAccountTheme(realm.getAccountTheme());
|
rep.setAccountTheme(realm.getAccountTheme());
|
||||||
rep.setLoginTheme(realm.getLoginTheme());
|
rep.setLoginTheme(realm.getLoginTheme());
|
||||||
rep.setAdminTheme(realm.getAdminTheme());
|
rep.setAdminTheme(realm.getAdminTheme());
|
||||||
rep.setEmailTheme(realm.getEmailTheme());
|
rep.setEmailTheme(realm.getEmailTheme());
|
||||||
if (realm.getPasswordPolicy() != null) {
|
if (realm.getPasswordPolicy() != null) {
|
||||||
rep.setPasswordPolicy(realm.getPasswordPolicy().toString());
|
rep.setPasswordPolicy(realm.getPasswordPolicy().toString());
|
||||||
}
|
}
|
||||||
|
|
||||||
List<String> defaultRoles = realm.getDefaultRoles();
|
List<String> defaultRoles = realm.getDefaultRoles();
|
||||||
if (!defaultRoles.isEmpty()) {
|
if (!defaultRoles.isEmpty()) {
|
||||||
List<String> roleStrings = new ArrayList<String>();
|
List<String> roleStrings = new ArrayList<String>();
|
||||||
roleStrings.addAll(defaultRoles);
|
roleStrings.addAll(defaultRoles);
|
||||||
rep.setDefaultRoles(roleStrings);
|
rep.setDefaultRoles(roleStrings);
|
||||||
}
|
}
|
||||||
|
|
||||||
List<RequiredCredentialModel> requiredCredentialModels = realm.getRequiredCredentials();
|
List<RequiredCredentialModel> requiredCredentialModels = realm.getRequiredCredentials();
|
||||||
if (requiredCredentialModels.size() > 0) {
|
if (requiredCredentialModels.size() > 0) {
|
||||||
rep.setRequiredCredentials(new HashSet<String>());
|
rep.setRequiredCredentials(new HashSet<String>());
|
||||||
for (RequiredCredentialModel cred : requiredCredentialModels) {
|
for (RequiredCredentialModel cred : requiredCredentialModels) {
|
||||||
rep.getRequiredCredentials().add(cred.getType());
|
rep.getRequiredCredentials().add(cred.getType());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
List<UserFederationProviderModel> fedProviderModels = realm.getUserFederationProviders();
|
List<UserFederationProviderModel> fedProviderModels = realm.getUserFederationProviders();
|
||||||
if (fedProviderModels.size() > 0) {
|
if (fedProviderModels.size() > 0) {
|
||||||
List<UserFederationProviderRepresentation> fedProviderReps = new ArrayList<UserFederationProviderRepresentation>();
|
List<UserFederationProviderRepresentation> fedProviderReps = new ArrayList<UserFederationProviderRepresentation>();
|
||||||
for (UserFederationProviderModel model : fedProviderModels) {
|
for (UserFederationProviderModel model : fedProviderModels) {
|
||||||
UserFederationProviderRepresentation fedProvRep = toRepresentation(model);
|
UserFederationProviderRepresentation fedProvRep = toRepresentation(model);
|
||||||
fedProviderReps.add(fedProvRep);
|
fedProviderReps.add(fedProvRep);
|
||||||
}
|
}
|
||||||
rep.setUserFederationProviders(fedProviderReps);
|
rep.setUserFederationProviders(fedProviderReps);
|
||||||
}
|
}
|
||||||
|
|
||||||
for (IdentityProviderModel provider : realm.getIdentityProviders()) {
|
for (IdentityProviderModel provider : realm.getIdentityProviders()) {
|
||||||
rep.addIdentityProvider(toRepresentation(provider));
|
rep.addIdentityProvider(toRepresentation(provider));
|
||||||
}
|
}
|
||||||
|
|
||||||
return rep;
|
return rep;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static RealmEventsConfigRepresentation toEventsConfigReprensetation(RealmModel realm) {
|
public static RealmEventsConfigRepresentation toEventsConfigReprensetation(RealmModel realm) {
|
||||||
RealmEventsConfigRepresentation rep = new RealmEventsConfigRepresentation();
|
RealmEventsConfigRepresentation rep = new RealmEventsConfigRepresentation();
|
||||||
rep.setEventsEnabled(realm.isEventsEnabled());
|
rep.setEventsEnabled(realm.isEventsEnabled());
|
||||||
|
|
||||||
if (realm.getEventsExpiration() != 0) {
|
if (realm.getEventsExpiration() != 0) {
|
||||||
rep.setEventsExpiration(realm.getEventsExpiration());
|
rep.setEventsExpiration(realm.getEventsExpiration());
|
||||||
}
|
}
|
||||||
|
|
||||||
if (realm.getEventsListeners() != null) {
|
if (realm.getEventsListeners() != null) {
|
||||||
rep.setEventsListeners(new LinkedList<String>(realm.getEventsListeners()));
|
rep.setEventsListeners(new LinkedList<String>(realm.getEventsListeners()));
|
||||||
}
|
}
|
||||||
return rep;
|
return rep;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static CredentialRepresentation toRepresentation(UserCredentialModel cred) {
|
public static CredentialRepresentation toRepresentation(UserCredentialModel cred) {
|
||||||
CredentialRepresentation rep = new CredentialRepresentation();
|
CredentialRepresentation rep = new CredentialRepresentation();
|
||||||
rep.setType(CredentialRepresentation.SECRET);
|
rep.setType(CredentialRepresentation.SECRET);
|
||||||
rep.setValue(cred.getValue());
|
rep.setValue(cred.getValue());
|
||||||
return rep;
|
return rep;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static ClaimRepresentation toRepresentation(ClientModel model) {
|
public static ClaimRepresentation toRepresentation(ClientModel model) {
|
||||||
ClaimRepresentation rep = new ClaimRepresentation();
|
ClaimRepresentation rep = new ClaimRepresentation();
|
||||||
rep.setAddress(ClaimMask.hasAddress(model.getAllowedClaimsMask()));
|
rep.setAddress(ClaimMask.hasAddress(model.getAllowedClaimsMask()));
|
||||||
rep.setEmail(ClaimMask.hasEmail(model.getAllowedClaimsMask()));
|
rep.setEmail(ClaimMask.hasEmail(model.getAllowedClaimsMask()));
|
||||||
rep.setGender(ClaimMask.hasGender(model.getAllowedClaimsMask()));
|
rep.setGender(ClaimMask.hasGender(model.getAllowedClaimsMask()));
|
||||||
rep.setLocale(ClaimMask.hasLocale(model.getAllowedClaimsMask()));
|
rep.setLocale(ClaimMask.hasLocale(model.getAllowedClaimsMask()));
|
||||||
rep.setName(ClaimMask.hasName(model.getAllowedClaimsMask()));
|
rep.setName(ClaimMask.hasName(model.getAllowedClaimsMask()));
|
||||||
rep.setPhone(ClaimMask.hasPhone(model.getAllowedClaimsMask()));
|
rep.setPhone(ClaimMask.hasPhone(model.getAllowedClaimsMask()));
|
||||||
rep.setPicture(ClaimMask.hasPicture(model.getAllowedClaimsMask()));
|
rep.setPicture(ClaimMask.hasPicture(model.getAllowedClaimsMask()));
|
||||||
rep.setProfile(ClaimMask.hasProfile(model.getAllowedClaimsMask()));
|
rep.setProfile(ClaimMask.hasProfile(model.getAllowedClaimsMask()));
|
||||||
rep.setWebsite(ClaimMask.hasWebsite(model.getAllowedClaimsMask()));
|
rep.setWebsite(ClaimMask.hasWebsite(model.getAllowedClaimsMask()));
|
||||||
rep.setUsername(ClaimMask.hasUsername(model.getAllowedClaimsMask()));
|
rep.setUsername(ClaimMask.hasUsername(model.getAllowedClaimsMask()));
|
||||||
return rep;
|
return rep;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static FederatedIdentityRepresentation toRepresentation(FederatedIdentityModel socialLink) {
|
public static FederatedIdentityRepresentation toRepresentation(FederatedIdentityModel socialLink) {
|
||||||
FederatedIdentityRepresentation rep = new FederatedIdentityRepresentation();
|
FederatedIdentityRepresentation rep = new FederatedIdentityRepresentation();
|
||||||
rep.setUserName(socialLink.getUserName());
|
rep.setUserName(socialLink.getUserName());
|
||||||
rep.setIdentityProvider(socialLink.getIdentityProvider());
|
rep.setIdentityProvider(socialLink.getIdentityProvider());
|
||||||
rep.setUserId(socialLink.getUserId());
|
rep.setUserId(socialLink.getUserId());
|
||||||
return rep;
|
return rep;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static UserSessionRepresentation toRepresentation(UserSessionModel session) {
|
public static UserSessionRepresentation toRepresentation(UserSessionModel session) {
|
||||||
UserSessionRepresentation rep = new UserSessionRepresentation();
|
UserSessionRepresentation rep = new UserSessionRepresentation();
|
||||||
rep.setId(session.getId());
|
rep.setId(session.getId());
|
||||||
rep.setStart(((long) session.getStarted()) * 1000L);
|
rep.setStart(((long) session.getStarted()) * 1000L);
|
||||||
rep.setLastAccess(((long) session.getLastSessionRefresh()) * 1000L);
|
rep.setLastAccess(((long) session.getLastSessionRefresh()) * 1000L);
|
||||||
rep.setUser(session.getUser().getUsername());
|
rep.setUser(session.getUser().getUsername());
|
||||||
rep.setIpAddress(session.getIpAddress());
|
rep.setIpAddress(session.getIpAddress());
|
||||||
for (ClientSessionModel clientSession : session.getClientSessions()) {
|
for (ClientSessionModel clientSession : session.getClientSessions()) {
|
||||||
ClientModel client = clientSession.getClient();
|
ClientModel client = clientSession.getClient();
|
||||||
if (client instanceof ApplicationModel) {
|
if (client instanceof ApplicationModel) {
|
||||||
rep.getApplications().put(client.getId(), client.getClientId());
|
rep.getApplications().put(client.getId(), client.getClientId());
|
||||||
} else if (client instanceof OAuthClientModel) {
|
} else if (client instanceof OAuthClientModel) {
|
||||||
rep.getClients().put(client.getId(), client.getClientId());
|
rep.getClients().put(client.getId(), client.getClientId());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return rep;
|
return rep;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static ApplicationRepresentation toRepresentation(ApplicationModel applicationModel) {
|
public static ApplicationRepresentation toRepresentation(ApplicationModel applicationModel) {
|
||||||
ApplicationRepresentation rep = new ApplicationRepresentation();
|
ApplicationRepresentation rep = new ApplicationRepresentation();
|
||||||
rep.setId(applicationModel.getId());
|
rep.setId(applicationModel.getId());
|
||||||
rep.setName(applicationModel.getName());
|
rep.setName(applicationModel.getName());
|
||||||
rep.setEnabled(applicationModel.isEnabled());
|
rep.setEnabled(applicationModel.isEnabled());
|
||||||
rep.setAdminUrl(applicationModel.getManagementUrl());
|
rep.setAdminUrl(applicationModel.getManagementUrl());
|
||||||
rep.setPublicClient(applicationModel.isPublicClient());
|
rep.setPublicClient(applicationModel.isPublicClient());
|
||||||
rep.setFrontchannelLogout(applicationModel.isFrontchannelLogout());
|
rep.setFrontchannelLogout(applicationModel.isFrontchannelLogout());
|
||||||
rep.setProtocol(applicationModel.getProtocol());
|
rep.setProtocol(applicationModel.getProtocol());
|
||||||
rep.setAttributes(applicationModel.getAttributes());
|
rep.setAttributes(applicationModel.getAttributes());
|
||||||
rep.setFullScopeAllowed(applicationModel.isFullScopeAllowed());
|
rep.setFullScopeAllowed(applicationModel.isFullScopeAllowed());
|
||||||
rep.setBearerOnly(applicationModel.isBearerOnly());
|
rep.setBearerOnly(applicationModel.isBearerOnly());
|
||||||
rep.setSurrogateAuthRequired(applicationModel.isSurrogateAuthRequired());
|
rep.setSurrogateAuthRequired(applicationModel.isSurrogateAuthRequired());
|
||||||
rep.setBaseUrl(applicationModel.getBaseUrl());
|
rep.setBaseUrl(applicationModel.getBaseUrl());
|
||||||
rep.setNotBefore(applicationModel.getNotBefore());
|
rep.setNotBefore(applicationModel.getNotBefore());
|
||||||
rep.setNodeReRegistrationTimeout(applicationModel.getNodeReRegistrationTimeout());
|
rep.setNodeReRegistrationTimeout(applicationModel.getNodeReRegistrationTimeout());
|
||||||
|
|
||||||
Set<String> redirectUris = applicationModel.getRedirectUris();
|
Set<String> redirectUris = applicationModel.getRedirectUris();
|
||||||
if (redirectUris != null) {
|
if (redirectUris != null) {
|
||||||
rep.setRedirectUris(new LinkedList<String>(redirectUris));
|
rep.setRedirectUris(new LinkedList<String>(redirectUris));
|
||||||
}
|
}
|
||||||
|
|
||||||
Set<String> webOrigins = applicationModel.getWebOrigins();
|
Set<String> webOrigins = applicationModel.getWebOrigins();
|
||||||
if (webOrigins != null) {
|
if (webOrigins != null) {
|
||||||
rep.setWebOrigins(new LinkedList<String>(webOrigins));
|
rep.setWebOrigins(new LinkedList<String>(webOrigins));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!applicationModel.getDefaultRoles().isEmpty()) {
|
if (!applicationModel.getDefaultRoles().isEmpty()) {
|
||||||
rep.setDefaultRoles(applicationModel.getDefaultRoles().toArray(new String[0]));
|
rep.setDefaultRoles(applicationModel.getDefaultRoles().toArray(new String[0]));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!applicationModel.getRegisteredNodes().isEmpty()) {
|
if (!applicationModel.getRegisteredNodes().isEmpty()) {
|
||||||
rep.setRegisteredNodes(new HashMap<String, Integer>(applicationModel.getRegisteredNodes()));
|
rep.setRegisteredNodes(new HashMap<String, Integer>(applicationModel.getRegisteredNodes()));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!applicationModel.getIdentityProviders().isEmpty()) {
|
if (!applicationModel.getIdentityProviders().isEmpty()) {
|
||||||
rep.setIdentityProviders(toRepresentation(applicationModel.getIdentityProviders()));
|
rep.setIdentityProviders(toRepresentation(applicationModel.getIdentityProviders()));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!applicationModel.getProtocolMappers().isEmpty()) {
|
if (!applicationModel.getProtocolMappers().isEmpty()) {
|
||||||
List<ProtocolMapperRepresentation> mappings = new LinkedList<ProtocolMapperRepresentation>();
|
List<ProtocolMapperRepresentation> mappings = new LinkedList<ProtocolMapperRepresentation>();
|
||||||
for (ProtocolMapperModel model : applicationModel.getProtocolMappers()) {
|
for (ProtocolMapperModel model : applicationModel.getProtocolMappers()) {
|
||||||
mappings.add(toRepresentation(model));
|
mappings.add(toRepresentation(model));
|
||||||
}
|
}
|
||||||
rep.setProtocolMappers(mappings);
|
rep.setProtocolMappers(mappings);
|
||||||
}
|
}
|
||||||
|
|
||||||
return rep;
|
return rep;
|
||||||
}
|
}
|
||||||
|
|
||||||
private static List<ClientIdentityProviderMappingRepresentation> toRepresentation(
|
private static List<ClientIdentityProviderMappingRepresentation> toRepresentation(
|
||||||
List<ClientIdentityProviderMappingModel> identityProviders) {
|
List<ClientIdentityProviderMappingModel> identityProviders) {
|
||||||
ArrayList<ClientIdentityProviderMappingRepresentation> representations = new ArrayList<ClientIdentityProviderMappingRepresentation>();
|
ArrayList<ClientIdentityProviderMappingRepresentation> representations = new ArrayList<ClientIdentityProviderMappingRepresentation>();
|
||||||
|
|
||||||
for (ClientIdentityProviderMappingModel model : identityProviders) {
|
for (ClientIdentityProviderMappingModel model : identityProviders) {
|
||||||
ClientIdentityProviderMappingRepresentation representation = new ClientIdentityProviderMappingRepresentation();
|
ClientIdentityProviderMappingRepresentation representation = new ClientIdentityProviderMappingRepresentation();
|
||||||
|
|
||||||
representation.setId(model.getIdentityProvider());
|
representation.setId(model.getIdentityProvider());
|
||||||
representation.setRetrieveToken(model.isRetrieveToken());
|
representation.setRetrieveToken(model.isRetrieveToken());
|
||||||
|
|
||||||
representations.add(representation);
|
representations.add(representation);
|
||||||
}
|
}
|
||||||
|
|
||||||
return representations;
|
return representations;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static OAuthClientRepresentation toRepresentation(OAuthClientModel model) {
|
public static OAuthClientRepresentation toRepresentation(OAuthClientModel model) {
|
||||||
OAuthClientRepresentation rep = new OAuthClientRepresentation();
|
OAuthClientRepresentation rep = new OAuthClientRepresentation();
|
||||||
rep.setId(model.getId());
|
rep.setId(model.getId());
|
||||||
rep.setName(model.getClientId());
|
rep.setName(model.getClientId());
|
||||||
rep.setEnabled(model.isEnabled());
|
rep.setEnabled(model.isEnabled());
|
||||||
rep.setPublicClient(model.isPublicClient());
|
rep.setPublicClient(model.isPublicClient());
|
||||||
rep.setFrontchannelLogout(model.isFrontchannelLogout());
|
rep.setFrontchannelLogout(model.isFrontchannelLogout());
|
||||||
rep.setProtocol(model.getProtocol());
|
rep.setProtocol(model.getProtocol());
|
||||||
rep.setAttributes(model.getAttributes());
|
rep.setAttributes(model.getAttributes());
|
||||||
rep.setFullScopeAllowed(model.isFullScopeAllowed());
|
rep.setFullScopeAllowed(model.isFullScopeAllowed());
|
||||||
rep.setDirectGrantsOnly(model.isDirectGrantsOnly());
|
rep.setDirectGrantsOnly(model.isDirectGrantsOnly());
|
||||||
Set<String> redirectUris = model.getRedirectUris();
|
Set<String> redirectUris = model.getRedirectUris();
|
||||||
if (redirectUris != null) {
|
if (redirectUris != null) {
|
||||||
rep.setRedirectUris(new LinkedList<String>(redirectUris));
|
rep.setRedirectUris(new LinkedList<String>(redirectUris));
|
||||||
}
|
}
|
||||||
|
|
||||||
Set<String> webOrigins = model.getWebOrigins();
|
Set<String> webOrigins = model.getWebOrigins();
|
||||||
if (webOrigins != null) {
|
if (webOrigins != null) {
|
||||||
rep.setWebOrigins(new LinkedList<String>(webOrigins));
|
rep.setWebOrigins(new LinkedList<String>(webOrigins));
|
||||||
}
|
}
|
||||||
rep.setNotBefore(model.getNotBefore());
|
rep.setNotBefore(model.getNotBefore());
|
||||||
|
|
||||||
if (!model.getIdentityProviders().isEmpty()) {
|
if (!model.getIdentityProviders().isEmpty()) {
|
||||||
rep.setIdentityProviders(toRepresentation(model.getIdentityProviders()));
|
rep.setIdentityProviders(toRepresentation(model.getIdentityProviders()));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!model.getProtocolMappers().isEmpty()) {
|
if (!model.getProtocolMappers().isEmpty()) {
|
||||||
List<ProtocolMapperRepresentation> mappings = new LinkedList<ProtocolMapperRepresentation>();
|
List<ProtocolMapperRepresentation> mappings = new LinkedList<ProtocolMapperRepresentation>();
|
||||||
for (ProtocolMapperModel mapper : model.getProtocolMappers()) {
|
for (ProtocolMapperModel mapper : model.getProtocolMappers()) {
|
||||||
mappings.add(toRepresentation(mapper));
|
mappings.add(toRepresentation(mapper));
|
||||||
}
|
}
|
||||||
rep.setProtocolMappers(mappings);
|
rep.setProtocolMappers(mappings);
|
||||||
}
|
}
|
||||||
|
|
||||||
return rep;
|
return rep;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static UserFederationProviderRepresentation toRepresentation(UserFederationProviderModel model) {
|
public static UserFederationProviderRepresentation toRepresentation(UserFederationProviderModel model) {
|
||||||
UserFederationProviderRepresentation rep = new UserFederationProviderRepresentation();
|
UserFederationProviderRepresentation rep = new UserFederationProviderRepresentation();
|
||||||
rep.setId(model.getId());
|
rep.setId(model.getId());
|
||||||
rep.setConfig(model.getConfig());
|
rep.setConfig(model.getConfig());
|
||||||
rep.setProviderName(model.getProviderName());
|
rep.setProviderName(model.getProviderName());
|
||||||
rep.setPriority(model.getPriority());
|
rep.setPriority(model.getPriority());
|
||||||
rep.setDisplayName(model.getDisplayName());
|
rep.setDisplayName(model.getDisplayName());
|
||||||
rep.setFullSyncPeriod(model.getFullSyncPeriod());
|
rep.setFullSyncPeriod(model.getFullSyncPeriod());
|
||||||
rep.setChangedSyncPeriod(model.getChangedSyncPeriod());
|
rep.setChangedSyncPeriod(model.getChangedSyncPeriod());
|
||||||
rep.setLastSync(model.getLastSync());
|
rep.setLastSync(model.getLastSync());
|
||||||
return rep;
|
return rep;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static IdentityProviderRepresentation toRepresentation(IdentityProviderModel identityProviderModel) {
|
public static IdentityProviderRepresentation toRepresentation(IdentityProviderModel identityProviderModel) {
|
||||||
IdentityProviderRepresentation providerRep = new IdentityProviderRepresentation();
|
IdentityProviderRepresentation providerRep = new IdentityProviderRepresentation();
|
||||||
|
|
||||||
providerRep.setInternalId(identityProviderModel.getInternalId());
|
providerRep.setInternalId(identityProviderModel.getInternalId());
|
||||||
providerRep.setProviderId(identityProviderModel.getProviderId());
|
providerRep.setProviderId(identityProviderModel.getProviderId());
|
||||||
providerRep.setId(identityProviderModel.getId());
|
providerRep.setId(identityProviderModel.getId());
|
||||||
providerRep.setName(identityProviderModel.getName());
|
providerRep.setName(identityProviderModel.getName());
|
||||||
providerRep.setEnabled(identityProviderModel.isEnabled());
|
providerRep.setEnabled(identityProviderModel.isEnabled());
|
||||||
providerRep.setStoreToken(identityProviderModel.isStoreToken());
|
providerRep.setStoreToken(identityProviderModel.isStoreToken());
|
||||||
providerRep.setUpdateProfileFirstLogin(identityProviderModel.isUpdateProfileFirstLogin());
|
providerRep.setUpdateProfileFirstLogin(identityProviderModel.isUpdateProfileFirstLogin());
|
||||||
providerRep.setAuthenticateByDefault(identityProviderModel.isAuthenticateByDefault());
|
providerRep.setAuthenticateByDefault(identityProviderModel.isAuthenticateByDefault());
|
||||||
providerRep.setConfig(identityProviderModel.getConfig());
|
providerRep.setConfig(identityProviderModel.getConfig());
|
||||||
|
|
||||||
return providerRep;
|
return providerRep;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static ProtocolMapperRepresentation toRepresentation(ProtocolMapperModel model) {
|
public static ProtocolMapperRepresentation toRepresentation(ProtocolMapperModel model) {
|
||||||
ProtocolMapperRepresentation rep = new ProtocolMapperRepresentation();
|
ProtocolMapperRepresentation rep = new ProtocolMapperRepresentation();
|
||||||
rep.setId(model.getId());
|
rep.setId(model.getId());
|
||||||
rep.setProtocol(model.getProtocol());
|
rep.setProtocol(model.getProtocol());
|
||||||
Map<String, String> config = new HashMap<String, String>();
|
Map<String, String> config = new HashMap<String, String>();
|
||||||
config.putAll(model.getConfig());
|
config.putAll(model.getConfig());
|
||||||
rep.setConfig(config);
|
rep.setConfig(config);
|
||||||
rep.setName(model.getName());
|
rep.setName(model.getName());
|
||||||
rep.setProtocolMapper(model.getProtocolMapper());
|
rep.setProtocolMapper(model.getProtocolMapper());
|
||||||
rep.setConsentText(model.getConsentText());
|
rep.setConsentText(model.getConsentText());
|
||||||
rep.setConsentRequired(model.isConsentRequired());
|
rep.setConsentRequired(model.isConsentRequired());
|
||||||
return rep;
|
return rep;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
File diff suppressed because it is too large
Load diff
File diff suppressed because it is too large
Load diff
File diff suppressed because it is too large
Load diff
|
@ -26,329 +26,329 @@ import org.keycloak.models.cache.RealmCache;
|
||||||
*/
|
*/
|
||||||
public class CachedRealm {
|
public class CachedRealm {
|
||||||
|
|
||||||
private String id;
|
private String id;
|
||||||
private String name;
|
private String name;
|
||||||
private boolean enabled;
|
private boolean enabled;
|
||||||
private SslRequired sslRequired;
|
private SslRequired sslRequired;
|
||||||
private boolean registrationAllowed;
|
private boolean registrationAllowed;
|
||||||
protected boolean registrationEmailAsUsername;
|
protected boolean registrationEmailAsUsername;
|
||||||
private boolean rememberMe;
|
private boolean rememberMe;
|
||||||
private boolean verifyEmail;
|
private boolean verifyEmail;
|
||||||
private boolean passwordCredentialGrantAllowed;
|
private boolean passwordCredentialGrantAllowed;
|
||||||
private boolean resetPasswordAllowed;
|
private boolean resetPasswordAllowed;
|
||||||
private boolean identityFederationEnabled;
|
private boolean identityFederationEnabled;
|
||||||
// --- brute force settings
|
// --- brute force settings
|
||||||
private boolean bruteForceProtected;
|
private boolean bruteForceProtected;
|
||||||
private int maxFailureWaitSeconds;
|
private int maxFailureWaitSeconds;
|
||||||
private int minimumQuickLoginWaitSeconds;
|
private int minimumQuickLoginWaitSeconds;
|
||||||
private int waitIncrementSeconds;
|
private int waitIncrementSeconds;
|
||||||
private long quickLoginCheckMilliSeconds;
|
private long quickLoginCheckMilliSeconds;
|
||||||
private int maxDeltaTimeSeconds;
|
private int maxDeltaTimeSeconds;
|
||||||
private int failureFactor;
|
private int failureFactor;
|
||||||
// --- end brute force settings
|
// --- end brute force settings
|
||||||
|
|
||||||
private int ssoSessionIdleTimeout;
|
private int ssoSessionIdleTimeout;
|
||||||
private int ssoSessionMaxLifespan;
|
private int ssoSessionMaxLifespan;
|
||||||
private int accessTokenLifespan;
|
private int accessTokenLifespan;
|
||||||
private int accessCodeLifespan;
|
private int accessCodeLifespan;
|
||||||
private int accessCodeLifespanUserAction;
|
private int accessCodeLifespanUserAction;
|
||||||
private int accessCodeLifespanLogin;
|
private int accessCodeLifespanLogin;
|
||||||
private int notBefore;
|
private int notBefore;
|
||||||
private PasswordPolicy passwordPolicy;
|
private PasswordPolicy passwordPolicy;
|
||||||
|
|
||||||
private String publicKeyPem;
|
private String publicKeyPem;
|
||||||
private String privateKeyPem;
|
private String privateKeyPem;
|
||||||
private String certificatePem;
|
private String certificatePem;
|
||||||
private String codeSecret;
|
private String codeSecret;
|
||||||
|
|
||||||
private String loginTheme;
|
private String loginTheme;
|
||||||
private String accountTheme;
|
private String accountTheme;
|
||||||
private String adminTheme;
|
private String adminTheme;
|
||||||
private String emailTheme;
|
private String emailTheme;
|
||||||
private String masterAdminApp;
|
private String masterAdminApp;
|
||||||
|
|
||||||
private List<RequiredCredentialModel> requiredCredentials = new ArrayList<RequiredCredentialModel>();
|
private List<RequiredCredentialModel> requiredCredentials = new ArrayList<RequiredCredentialModel>();
|
||||||
private List<UserFederationProviderModel> userFederationProviders = new ArrayList<UserFederationProviderModel>();
|
private List<UserFederationProviderModel> userFederationProviders = new ArrayList<UserFederationProviderModel>();
|
||||||
private List<IdentityProviderModel> identityProviders = new ArrayList<IdentityProviderModel>();
|
private List<IdentityProviderModel> identityProviders = new ArrayList<IdentityProviderModel>();
|
||||||
|
|
||||||
private Map<String, String> browserSecurityHeaders = new HashMap<String, String>();
|
private Map<String, String> browserSecurityHeaders = new HashMap<String, String>();
|
||||||
private Map<String, String> smtpConfig = new HashMap<String, String>();
|
private Map<String, String> smtpConfig = new HashMap<String, String>();
|
||||||
|
|
||||||
private boolean eventsEnabled;
|
private boolean eventsEnabled;
|
||||||
private long eventsExpiration;
|
private long eventsExpiration;
|
||||||
private Set<String> eventsListeners = new HashSet<String>();
|
private Set<String> eventsListeners = new HashSet<String>();
|
||||||
private List<String> defaultRoles = new LinkedList<String>();
|
private List<String> defaultRoles = new LinkedList<String>();
|
||||||
private Map<String, String> realmRoles = new HashMap<String, String>();
|
private Map<String, String> realmRoles = new HashMap<String, String>();
|
||||||
private Map<String, String> applications = new HashMap<String, String>();
|
private Map<String, String> applications = new HashMap<String, String>();
|
||||||
private Map<String, String> clients = new HashMap<String, String>();
|
private Map<String, String> clients = new HashMap<String, String>();
|
||||||
|
|
||||||
public CachedRealm() {
|
public CachedRealm() {
|
||||||
}
|
}
|
||||||
|
|
||||||
public CachedRealm(RealmCache cache, RealmProvider delegate, RealmModel model) {
|
public CachedRealm(RealmCache cache, RealmProvider delegate, RealmModel model) {
|
||||||
id = model.getId();
|
id = model.getId();
|
||||||
name = model.getName();
|
name = model.getName();
|
||||||
enabled = model.isEnabled();
|
enabled = model.isEnabled();
|
||||||
sslRequired = model.getSslRequired();
|
sslRequired = model.getSslRequired();
|
||||||
registrationAllowed = model.isRegistrationAllowed();
|
registrationAllowed = model.isRegistrationAllowed();
|
||||||
registrationEmailAsUsername = model.isRegistrationEmailAsUsername();
|
registrationEmailAsUsername = model.isRegistrationEmailAsUsername();
|
||||||
rememberMe = model.isRememberMe();
|
rememberMe = model.isRememberMe();
|
||||||
verifyEmail = model.isVerifyEmail();
|
verifyEmail = model.isVerifyEmail();
|
||||||
passwordCredentialGrantAllowed = model.isPasswordCredentialGrantAllowed();
|
passwordCredentialGrantAllowed = model.isPasswordCredentialGrantAllowed();
|
||||||
resetPasswordAllowed = model.isResetPasswordAllowed();
|
resetPasswordAllowed = model.isResetPasswordAllowed();
|
||||||
identityFederationEnabled = model.isIdentityFederationEnabled();
|
identityFederationEnabled = model.isIdentityFederationEnabled();
|
||||||
// --- brute force settings
|
// --- brute force settings
|
||||||
bruteForceProtected = model.isBruteForceProtected();
|
bruteForceProtected = model.isBruteForceProtected();
|
||||||
maxFailureWaitSeconds = model.getMaxFailureWaitSeconds();
|
maxFailureWaitSeconds = model.getMaxFailureWaitSeconds();
|
||||||
minimumQuickLoginWaitSeconds = model.getMinimumQuickLoginWaitSeconds();
|
minimumQuickLoginWaitSeconds = model.getMinimumQuickLoginWaitSeconds();
|
||||||
waitIncrementSeconds = model.getWaitIncrementSeconds();
|
waitIncrementSeconds = model.getWaitIncrementSeconds();
|
||||||
quickLoginCheckMilliSeconds = model.getQuickLoginCheckMilliSeconds();
|
quickLoginCheckMilliSeconds = model.getQuickLoginCheckMilliSeconds();
|
||||||
maxDeltaTimeSeconds = model.getMaxDeltaTimeSeconds();
|
maxDeltaTimeSeconds = model.getMaxDeltaTimeSeconds();
|
||||||
failureFactor = model.getFailureFactor();
|
failureFactor = model.getFailureFactor();
|
||||||
// --- end brute force settings
|
// --- end brute force settings
|
||||||
|
|
||||||
ssoSessionIdleTimeout = model.getSsoSessionIdleTimeout();
|
ssoSessionIdleTimeout = model.getSsoSessionIdleTimeout();
|
||||||
ssoSessionMaxLifespan = model.getSsoSessionMaxLifespan();
|
ssoSessionMaxLifespan = model.getSsoSessionMaxLifespan();
|
||||||
accessTokenLifespan = model.getAccessTokenLifespan();
|
accessTokenLifespan = model.getAccessTokenLifespan();
|
||||||
accessCodeLifespan = model.getAccessCodeLifespan();
|
accessCodeLifespan = model.getAccessCodeLifespan();
|
||||||
accessCodeLifespanUserAction = model.getAccessCodeLifespanUserAction();
|
accessCodeLifespanUserAction = model.getAccessCodeLifespanUserAction();
|
||||||
accessCodeLifespanLogin = model.getAccessCodeLifespanLogin();
|
accessCodeLifespanLogin = model.getAccessCodeLifespanLogin();
|
||||||
notBefore = model.getNotBefore();
|
notBefore = model.getNotBefore();
|
||||||
passwordPolicy = model.getPasswordPolicy();
|
passwordPolicy = model.getPasswordPolicy();
|
||||||
|
|
||||||
publicKeyPem = model.getPublicKeyPem();
|
publicKeyPem = model.getPublicKeyPem();
|
||||||
privateKeyPem = model.getPrivateKeyPem();
|
privateKeyPem = model.getPrivateKeyPem();
|
||||||
certificatePem = model.getCertificatePem();
|
certificatePem = model.getCertificatePem();
|
||||||
codeSecret = model.getCodeSecret();
|
codeSecret = model.getCodeSecret();
|
||||||
|
|
||||||
loginTheme = model.getLoginTheme();
|
loginTheme = model.getLoginTheme();
|
||||||
accountTheme = model.getAccountTheme();
|
accountTheme = model.getAccountTheme();
|
||||||
adminTheme = model.getAdminTheme();
|
adminTheme = model.getAdminTheme();
|
||||||
emailTheme = model.getEmailTheme();
|
emailTheme = model.getEmailTheme();
|
||||||
|
|
||||||
requiredCredentials = model.getRequiredCredentials();
|
requiredCredentials = model.getRequiredCredentials();
|
||||||
userFederationProviders = model.getUserFederationProviders();
|
userFederationProviders = model.getUserFederationProviders();
|
||||||
|
|
||||||
this.identityProviders = new ArrayList<IdentityProviderModel>();
|
this.identityProviders = new ArrayList<IdentityProviderModel>();
|
||||||
|
|
||||||
for (IdentityProviderModel identityProviderModel : model.getIdentityProviders()) {
|
for (IdentityProviderModel identityProviderModel : model.getIdentityProviders()) {
|
||||||
this.identityProviders.add(new IdentityProviderModel(identityProviderModel));
|
this.identityProviders.add(new IdentityProviderModel(identityProviderModel));
|
||||||
}
|
}
|
||||||
|
|
||||||
smtpConfig.putAll(model.getSmtpConfig());
|
smtpConfig.putAll(model.getSmtpConfig());
|
||||||
browserSecurityHeaders.putAll(model.getBrowserSecurityHeaders());
|
browserSecurityHeaders.putAll(model.getBrowserSecurityHeaders());
|
||||||
|
|
||||||
eventsEnabled = model.isEventsEnabled();
|
eventsEnabled = model.isEventsEnabled();
|
||||||
eventsExpiration = model.getEventsExpiration();
|
eventsExpiration = model.getEventsExpiration();
|
||||||
eventsListeners.addAll(model.getEventsListeners());
|
eventsListeners.addAll(model.getEventsListeners());
|
||||||
defaultRoles.addAll(model.getDefaultRoles());
|
defaultRoles.addAll(model.getDefaultRoles());
|
||||||
masterAdminApp = model.getMasterAdminApp().getId();
|
masterAdminApp = model.getMasterAdminApp().getId();
|
||||||
|
|
||||||
for (RoleModel role : model.getRoles()) {
|
for (RoleModel role : model.getRoles()) {
|
||||||
realmRoles.put(role.getName(), role.getId());
|
realmRoles.put(role.getName(), role.getId());
|
||||||
CachedRole cachedRole = new CachedRealmRole(role, model);
|
CachedRole cachedRole = new CachedRealmRole(role, model);
|
||||||
cache.addCachedRole(cachedRole);
|
cache.addCachedRole(cachedRole);
|
||||||
}
|
}
|
||||||
|
|
||||||
for (ApplicationModel app : model.getApplications()) {
|
for (ApplicationModel app : model.getApplications()) {
|
||||||
applications.put(app.getName(), app.getId());
|
applications.put(app.getName(), app.getId());
|
||||||
CachedApplication cachedApp = new CachedApplication(cache, delegate, model, app);
|
CachedApplication cachedApp = new CachedApplication(cache, delegate, model, app);
|
||||||
cache.addCachedApplication(cachedApp);
|
cache.addCachedApplication(cachedApp);
|
||||||
}
|
}
|
||||||
|
|
||||||
for (OAuthClientModel client : model.getOAuthClients()) {
|
for (OAuthClientModel client : model.getOAuthClients()) {
|
||||||
clients.put(client.getClientId(), client.getId());
|
clients.put(client.getClientId(), client.getId());
|
||||||
CachedOAuthClient cachedApp = new CachedOAuthClient(cache, delegate, model, client);
|
CachedOAuthClient cachedApp = new CachedOAuthClient(cache, delegate, model, client);
|
||||||
cache.addCachedOAuthClient(cachedApp);
|
cache.addCachedOAuthClient(cachedApp);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getId() {
|
public String getId() {
|
||||||
return id;
|
return id;
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getMasterAdminApp() {
|
public String getMasterAdminApp() {
|
||||||
return masterAdminApp;
|
return masterAdminApp;
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getName() {
|
public String getName() {
|
||||||
return name;
|
return name;
|
||||||
}
|
}
|
||||||
|
|
||||||
public List<String> getDefaultRoles() {
|
public List<String> getDefaultRoles() {
|
||||||
return defaultRoles;
|
return defaultRoles;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Map<String, String> getRealmRoles() {
|
public Map<String, String> getRealmRoles() {
|
||||||
return realmRoles;
|
return realmRoles;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Map<String, String> getApplications() {
|
public Map<String, String> getApplications() {
|
||||||
return applications;
|
return applications;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Map<String, String> getClients() {
|
public Map<String, String> getClients() {
|
||||||
return clients;
|
return clients;
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean isEnabled() {
|
public boolean isEnabled() {
|
||||||
return enabled;
|
return enabled;
|
||||||
}
|
}
|
||||||
|
|
||||||
public SslRequired getSslRequired() {
|
public SslRequired getSslRequired() {
|
||||||
return sslRequired;
|
return sslRequired;
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean isRegistrationAllowed() {
|
public boolean isRegistrationAllowed() {
|
||||||
return registrationAllowed;
|
return registrationAllowed;
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean isRegistrationEmailAsUsername() {
|
public boolean isRegistrationEmailAsUsername() {
|
||||||
return registrationEmailAsUsername;
|
return registrationEmailAsUsername;
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean isPasswordCredentialGrantAllowed() {
|
public boolean isPasswordCredentialGrantAllowed() {
|
||||||
return passwordCredentialGrantAllowed;
|
return passwordCredentialGrantAllowed;
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean isRememberMe() {
|
public boolean isRememberMe() {
|
||||||
return this.rememberMe;
|
return this.rememberMe;
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean isBruteForceProtected() {
|
public boolean isBruteForceProtected() {
|
||||||
return bruteForceProtected;
|
return bruteForceProtected;
|
||||||
}
|
}
|
||||||
|
|
||||||
public int getMaxFailureWaitSeconds() {
|
public int getMaxFailureWaitSeconds() {
|
||||||
return this.maxFailureWaitSeconds;
|
return this.maxFailureWaitSeconds;
|
||||||
}
|
}
|
||||||
|
|
||||||
public int getWaitIncrementSeconds() {
|
public int getWaitIncrementSeconds() {
|
||||||
return this.waitIncrementSeconds;
|
return this.waitIncrementSeconds;
|
||||||
}
|
}
|
||||||
|
|
||||||
public int getMinimumQuickLoginWaitSeconds() {
|
public int getMinimumQuickLoginWaitSeconds() {
|
||||||
return this.minimumQuickLoginWaitSeconds;
|
return this.minimumQuickLoginWaitSeconds;
|
||||||
}
|
}
|
||||||
|
|
||||||
public long getQuickLoginCheckMilliSeconds() {
|
public long getQuickLoginCheckMilliSeconds() {
|
||||||
return quickLoginCheckMilliSeconds;
|
return quickLoginCheckMilliSeconds;
|
||||||
}
|
}
|
||||||
|
|
||||||
public int getMaxDeltaTimeSeconds() {
|
public int getMaxDeltaTimeSeconds() {
|
||||||
return maxDeltaTimeSeconds;
|
return maxDeltaTimeSeconds;
|
||||||
}
|
}
|
||||||
|
|
||||||
public int getFailureFactor() {
|
public int getFailureFactor() {
|
||||||
return failureFactor;
|
return failureFactor;
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean isVerifyEmail() {
|
public boolean isVerifyEmail() {
|
||||||
return verifyEmail;
|
return verifyEmail;
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean isResetPasswordAllowed() {
|
public boolean isResetPasswordAllowed() {
|
||||||
return resetPasswordAllowed;
|
return resetPasswordAllowed;
|
||||||
}
|
}
|
||||||
|
|
||||||
public int getSsoSessionIdleTimeout() {
|
public int getSsoSessionIdleTimeout() {
|
||||||
return ssoSessionIdleTimeout;
|
return ssoSessionIdleTimeout;
|
||||||
}
|
}
|
||||||
|
|
||||||
public int getSsoSessionMaxLifespan() {
|
public int getSsoSessionMaxLifespan() {
|
||||||
return ssoSessionMaxLifespan;
|
return ssoSessionMaxLifespan;
|
||||||
}
|
}
|
||||||
|
|
||||||
public int getAccessTokenLifespan() {
|
public int getAccessTokenLifespan() {
|
||||||
return accessTokenLifespan;
|
return accessTokenLifespan;
|
||||||
}
|
}
|
||||||
|
|
||||||
public int getAccessCodeLifespan() {
|
public int getAccessCodeLifespan() {
|
||||||
return accessCodeLifespan;
|
return accessCodeLifespan;
|
||||||
}
|
}
|
||||||
|
|
||||||
public int getAccessCodeLifespanUserAction() {
|
public int getAccessCodeLifespanUserAction() {
|
||||||
return accessCodeLifespanUserAction;
|
return accessCodeLifespanUserAction;
|
||||||
}
|
}
|
||||||
|
|
||||||
public int getAccessCodeLifespanLogin() {
|
public int getAccessCodeLifespanLogin() {
|
||||||
return accessCodeLifespanLogin;
|
return accessCodeLifespanLogin;
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getPublicKeyPem() {
|
public String getPublicKeyPem() {
|
||||||
return publicKeyPem;
|
return publicKeyPem;
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getPrivateKeyPem() {
|
public String getPrivateKeyPem() {
|
||||||
return privateKeyPem;
|
return privateKeyPem;
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getCodeSecret() {
|
public String getCodeSecret() {
|
||||||
return codeSecret;
|
return codeSecret;
|
||||||
}
|
}
|
||||||
|
|
||||||
public List<RequiredCredentialModel> getRequiredCredentials() {
|
public List<RequiredCredentialModel> getRequiredCredentials() {
|
||||||
return requiredCredentials;
|
return requiredCredentials;
|
||||||
}
|
}
|
||||||
|
|
||||||
public PasswordPolicy getPasswordPolicy() {
|
public PasswordPolicy getPasswordPolicy() {
|
||||||
return passwordPolicy;
|
return passwordPolicy;
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean isIdentityFederationEnabled() {
|
public boolean isIdentityFederationEnabled() {
|
||||||
return identityFederationEnabled;
|
return identityFederationEnabled;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Map<String, String> getSmtpConfig() {
|
public Map<String, String> getSmtpConfig() {
|
||||||
return smtpConfig;
|
return smtpConfig;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Map<String, String> getBrowserSecurityHeaders() {
|
public Map<String, String> getBrowserSecurityHeaders() {
|
||||||
return browserSecurityHeaders;
|
return browserSecurityHeaders;
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getLoginTheme() {
|
public String getLoginTheme() {
|
||||||
return loginTheme;
|
return loginTheme;
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getAccountTheme() {
|
public String getAccountTheme() {
|
||||||
return accountTheme;
|
return accountTheme;
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getAdminTheme() {
|
public String getAdminTheme() {
|
||||||
return this.adminTheme;
|
return this.adminTheme;
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getEmailTheme() {
|
public String getEmailTheme() {
|
||||||
return emailTheme;
|
return emailTheme;
|
||||||
}
|
}
|
||||||
|
|
||||||
public int getNotBefore() {
|
public int getNotBefore() {
|
||||||
return notBefore;
|
return notBefore;
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean isEventsEnabled() {
|
public boolean isEventsEnabled() {
|
||||||
return eventsEnabled;
|
return eventsEnabled;
|
||||||
}
|
}
|
||||||
|
|
||||||
public long getEventsExpiration() {
|
public long getEventsExpiration() {
|
||||||
return eventsExpiration;
|
return eventsExpiration;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Set<String> getEventsListeners() {
|
public Set<String> getEventsListeners() {
|
||||||
return eventsListeners;
|
return eventsListeners;
|
||||||
}
|
}
|
||||||
|
|
||||||
public List<UserFederationProviderModel> getUserFederationProviders() {
|
public List<UserFederationProviderModel> getUserFederationProviders() {
|
||||||
return userFederationProviders;
|
return userFederationProviders;
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getCertificatePem() {
|
public String getCertificatePem() {
|
||||||
return certificatePem;
|
return certificatePem;
|
||||||
}
|
}
|
||||||
|
|
||||||
public List<IdentityProviderModel> getIdentityProviders() {
|
public List<IdentityProviderModel> getIdentityProviders() {
|
||||||
return identityProviders;
|
return identityProviders;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
File diff suppressed because it is too large
Load diff
|
@ -31,425 +31,425 @@ import javax.persistence.Table;
|
||||||
@Table(name = "REALM")
|
@Table(name = "REALM")
|
||||||
@Entity
|
@Entity
|
||||||
@NamedQueries({ @NamedQuery(name = "getAllRealms", query = "select realm from RealmEntity realm"),
|
@NamedQueries({ @NamedQuery(name = "getAllRealms", query = "select realm from RealmEntity realm"),
|
||||||
@NamedQuery(name = "getRealmByName", query = "select realm from RealmEntity realm where realm.name = :name"), })
|
@NamedQuery(name = "getRealmByName", query = "select realm from RealmEntity realm where realm.name = :name"), })
|
||||||
public class RealmEntity {
|
public class RealmEntity {
|
||||||
@Id
|
@Id
|
||||||
@Column(name = "ID", length = 36)
|
@Column(name = "ID", length = 36)
|
||||||
protected String id;
|
protected String id;
|
||||||
|
|
||||||
@Column(name = "NAME", unique = true)
|
@Column(name = "NAME", unique = true)
|
||||||
protected String name;
|
protected String name;
|
||||||
|
|
||||||
@Column(name = "ENABLED")
|
@Column(name = "ENABLED")
|
||||||
protected boolean enabled;
|
protected boolean enabled;
|
||||||
@Column(name = "SSL_REQUIRED")
|
@Column(name = "SSL_REQUIRED")
|
||||||
protected String sslRequired;
|
protected String sslRequired;
|
||||||
@Column(name = "REGISTRATION_ALLOWED")
|
@Column(name = "REGISTRATION_ALLOWED")
|
||||||
protected boolean registrationAllowed;
|
protected boolean registrationAllowed;
|
||||||
@Column(name = "REGISTRATION_EMAIL_AS_USERNAME")
|
@Column(name = "REGISTRATION_EMAIL_AS_USERNAME")
|
||||||
protected boolean registrationEmailAsUsername;
|
protected boolean registrationEmailAsUsername;
|
||||||
@Column(name = "PASSWORD_CRED_GRANT_ALLOWED")
|
@Column(name = "PASSWORD_CRED_GRANT_ALLOWED")
|
||||||
protected boolean passwordCredentialGrantAllowed;
|
protected boolean passwordCredentialGrantAllowed;
|
||||||
@Column(name = "VERIFY_EMAIL")
|
@Column(name = "VERIFY_EMAIL")
|
||||||
protected boolean verifyEmail;
|
protected boolean verifyEmail;
|
||||||
@Column(name = "RESET_PASSWORD_ALLOWED")
|
@Column(name = "RESET_PASSWORD_ALLOWED")
|
||||||
protected boolean resetPasswordAllowed;
|
protected boolean resetPasswordAllowed;
|
||||||
@Column(name = "REMEMBER_ME")
|
@Column(name = "REMEMBER_ME")
|
||||||
protected boolean rememberMe;
|
protected boolean rememberMe;
|
||||||
@Column(name = "PASSWORD_POLICY")
|
@Column(name = "PASSWORD_POLICY")
|
||||||
protected String passwordPolicy;
|
protected String passwordPolicy;
|
||||||
|
|
||||||
@Column(name = "SSO_IDLE_TIMEOUT")
|
@Column(name = "SSO_IDLE_TIMEOUT")
|
||||||
private int ssoSessionIdleTimeout;
|
private int ssoSessionIdleTimeout;
|
||||||
@Column(name = "SSO_MAX_LIFESPAN")
|
@Column(name = "SSO_MAX_LIFESPAN")
|
||||||
private int ssoSessionMaxLifespan;
|
private int ssoSessionMaxLifespan;
|
||||||
@Column(name = "ACCESS_TOKEN_LIFESPAN")
|
@Column(name = "ACCESS_TOKEN_LIFESPAN")
|
||||||
protected int accessTokenLifespan;
|
protected int accessTokenLifespan;
|
||||||
@Column(name = "ACCESS_CODE_LIFESPAN")
|
@Column(name = "ACCESS_CODE_LIFESPAN")
|
||||||
protected int accessCodeLifespan;
|
protected int accessCodeLifespan;
|
||||||
@Column(name = "USER_ACTION_LIFESPAN")
|
@Column(name = "USER_ACTION_LIFESPAN")
|
||||||
protected int accessCodeLifespanUserAction;
|
protected int accessCodeLifespanUserAction;
|
||||||
@Column(name = "LOGIN_LIFESPAN")
|
@Column(name = "LOGIN_LIFESPAN")
|
||||||
protected int accessCodeLifespanLogin;
|
protected int accessCodeLifespanLogin;
|
||||||
@Column(name = "NOT_BEFORE")
|
@Column(name = "NOT_BEFORE")
|
||||||
protected int notBefore;
|
protected int notBefore;
|
||||||
|
|
||||||
@Column(name = "PUBLIC_KEY", length = 2048)
|
@Column(name = "PUBLIC_KEY", length = 2048)
|
||||||
protected String publicKeyPem;
|
protected String publicKeyPem;
|
||||||
@Column(name = "PRIVATE_KEY", length = 2048)
|
@Column(name = "PRIVATE_KEY", length = 2048)
|
||||||
protected String privateKeyPem;
|
protected String privateKeyPem;
|
||||||
@Column(name = "CERTIFICATE", length = 2048)
|
@Column(name = "CERTIFICATE", length = 2048)
|
||||||
protected String certificatePem;
|
protected String certificatePem;
|
||||||
@Column(name = "CODE_SECRET", length = 255)
|
@Column(name = "CODE_SECRET", length = 255)
|
||||||
protected String codeSecret;
|
protected String codeSecret;
|
||||||
|
|
||||||
@Column(name = "LOGIN_THEME")
|
@Column(name = "LOGIN_THEME")
|
||||||
protected String loginTheme;
|
protected String loginTheme;
|
||||||
@Column(name = "ACCOUNT_THEME")
|
@Column(name = "ACCOUNT_THEME")
|
||||||
protected String accountTheme;
|
protected String accountTheme;
|
||||||
@Column(name = "ADMIN_THEME")
|
@Column(name = "ADMIN_THEME")
|
||||||
protected String adminTheme;
|
protected String adminTheme;
|
||||||
@Column(name = "EMAIL_THEME")
|
@Column(name = "EMAIL_THEME")
|
||||||
protected String emailTheme;
|
protected String emailTheme;
|
||||||
|
|
||||||
@OneToMany(cascade = { CascadeType.REMOVE }, orphanRemoval = true, mappedBy = "realm")
|
@OneToMany(cascade = { CascadeType.REMOVE }, orphanRemoval = true, mappedBy = "realm")
|
||||||
Collection<RealmAttributeEntity> attributes = new ArrayList<RealmAttributeEntity>();
|
Collection<RealmAttributeEntity> attributes = new ArrayList<RealmAttributeEntity>();
|
||||||
|
|
||||||
@OneToMany(cascade = { CascadeType.REMOVE }, orphanRemoval = true, mappedBy = "realm")
|
@OneToMany(cascade = { CascadeType.REMOVE }, orphanRemoval = true, mappedBy = "realm")
|
||||||
Collection<RequiredCredentialEntity> requiredCredentials = new ArrayList<RequiredCredentialEntity>();
|
Collection<RequiredCredentialEntity> requiredCredentials = new ArrayList<RequiredCredentialEntity>();
|
||||||
|
|
||||||
@OneToMany(cascade = { CascadeType.REMOVE }, orphanRemoval = true)
|
@OneToMany(cascade = { CascadeType.REMOVE }, orphanRemoval = true)
|
||||||
@JoinTable(name = "FED_PROVIDERS")
|
@JoinTable(name = "FED_PROVIDERS")
|
||||||
List<UserFederationProviderEntity> userFederationProviders = new ArrayList<UserFederationProviderEntity>();
|
List<UserFederationProviderEntity> userFederationProviders = new ArrayList<UserFederationProviderEntity>();
|
||||||
|
|
||||||
@OneToMany(fetch = FetchType.LAZY, cascade = { CascadeType.REMOVE }, orphanRemoval = true)
|
@OneToMany(fetch = FetchType.LAZY, cascade = { CascadeType.REMOVE }, orphanRemoval = true)
|
||||||
@JoinTable(name = "REALM_APPLICATION", joinColumns = { @JoinColumn(name = "APPLICATION_ID") }, inverseJoinColumns = { @JoinColumn(name = "REALM_ID") })
|
@JoinTable(name = "REALM_APPLICATION", joinColumns = { @JoinColumn(name = "APPLICATION_ID") }, inverseJoinColumns = { @JoinColumn(name = "REALM_ID") })
|
||||||
Collection<ApplicationEntity> applications = new ArrayList<ApplicationEntity>();
|
Collection<ApplicationEntity> applications = new ArrayList<ApplicationEntity>();
|
||||||
|
|
||||||
@OneToMany(fetch = FetchType.LAZY, cascade = { CascadeType.REMOVE }, orphanRemoval = true, mappedBy = "realm")
|
@OneToMany(fetch = FetchType.LAZY, cascade = { CascadeType.REMOVE }, orphanRemoval = true, mappedBy = "realm")
|
||||||
Collection<RoleEntity> roles = new ArrayList<RoleEntity>();
|
Collection<RoleEntity> roles = new ArrayList<RoleEntity>();
|
||||||
|
|
||||||
@ElementCollection
|
@ElementCollection
|
||||||
@MapKeyColumn(name = "NAME")
|
@MapKeyColumn(name = "NAME")
|
||||||
@Column(name = "VALUE")
|
@Column(name = "VALUE")
|
||||||
@CollectionTable(name = "REALM_SMTP_CONFIG", joinColumns = { @JoinColumn(name = "REALM_ID") })
|
@CollectionTable(name = "REALM_SMTP_CONFIG", joinColumns = { @JoinColumn(name = "REALM_ID") })
|
||||||
protected Map<String, String> smtpConfig = new HashMap<String, String>();
|
protected Map<String, String> smtpConfig = new HashMap<String, String>();
|
||||||
|
|
||||||
@OneToMany(fetch = FetchType.LAZY, cascade = { CascadeType.REMOVE }, orphanRemoval = true)
|
@OneToMany(fetch = FetchType.LAZY, cascade = { CascadeType.REMOVE }, orphanRemoval = true)
|
||||||
@JoinTable(name = "REALM_DEFAULT_ROLES", joinColumns = { @JoinColumn(name = "REALM_ID") }, inverseJoinColumns = { @JoinColumn(name = "ROLE_ID") })
|
@JoinTable(name = "REALM_DEFAULT_ROLES", joinColumns = { @JoinColumn(name = "REALM_ID") }, inverseJoinColumns = { @JoinColumn(name = "ROLE_ID") })
|
||||||
protected Collection<RoleEntity> defaultRoles = new ArrayList<RoleEntity>();
|
protected Collection<RoleEntity> defaultRoles = new ArrayList<RoleEntity>();
|
||||||
|
|
||||||
@Column(name = "EVENTS_ENABLED")
|
@Column(name = "EVENTS_ENABLED")
|
||||||
protected boolean eventsEnabled;
|
protected boolean eventsEnabled;
|
||||||
@Column(name = "EVENTS_EXPIRATION")
|
@Column(name = "EVENTS_EXPIRATION")
|
||||||
protected long eventsExpiration;
|
protected long eventsExpiration;
|
||||||
|
|
||||||
@ElementCollection
|
@ElementCollection
|
||||||
@Column(name = "VALUE")
|
@Column(name = "VALUE")
|
||||||
@CollectionTable(name = "REALM_EVENTS_LISTENERS", joinColumns = { @JoinColumn(name = "REALM_ID") })
|
@CollectionTable(name = "REALM_EVENTS_LISTENERS", joinColumns = { @JoinColumn(name = "REALM_ID") })
|
||||||
protected Set<String> eventsListeners = new HashSet<String>();
|
protected Set<String> eventsListeners = new HashSet<String>();
|
||||||
|
|
||||||
@OneToOne
|
@OneToOne
|
||||||
@JoinColumn(name = "MASTER_ADMIN_APP")
|
@JoinColumn(name = "MASTER_ADMIN_APP")
|
||||||
protected ApplicationEntity masterAdminApp;
|
protected ApplicationEntity masterAdminApp;
|
||||||
|
|
||||||
@OneToMany(cascade = { CascadeType.REMOVE }, orphanRemoval = true, mappedBy = "realm")
|
@OneToMany(cascade = { CascadeType.REMOVE }, orphanRemoval = true, mappedBy = "realm")
|
||||||
protected List<IdentityProviderEntity> identityProviders = new ArrayList<IdentityProviderEntity>();
|
protected List<IdentityProviderEntity> identityProviders = new ArrayList<IdentityProviderEntity>();
|
||||||
|
|
||||||
public String getId() {
|
public String getId() {
|
||||||
return id;
|
return id;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setId(String id) {
|
public void setId(String id) {
|
||||||
this.id = id;
|
this.id = id;
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getName() {
|
public String getName() {
|
||||||
return name;
|
return name;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setName(String name) {
|
public void setName(String name) {
|
||||||
this.name = name;
|
this.name = name;
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean isEnabled() {
|
public boolean isEnabled() {
|
||||||
return enabled;
|
return enabled;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setEnabled(boolean enabled) {
|
public void setEnabled(boolean enabled) {
|
||||||
this.enabled = enabled;
|
this.enabled = enabled;
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getSslRequired() {
|
public String getSslRequired() {
|
||||||
return sslRequired;
|
return sslRequired;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setSslRequired(String sslRequired) {
|
public void setSslRequired(String sslRequired) {
|
||||||
this.sslRequired = sslRequired;
|
this.sslRequired = sslRequired;
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean isPasswordCredentialGrantAllowed() {
|
public boolean isPasswordCredentialGrantAllowed() {
|
||||||
return passwordCredentialGrantAllowed;
|
return passwordCredentialGrantAllowed;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setPasswordCredentialGrantAllowed(boolean passwordCredentialGrantAllowed) {
|
public void setPasswordCredentialGrantAllowed(boolean passwordCredentialGrantAllowed) {
|
||||||
this.passwordCredentialGrantAllowed = passwordCredentialGrantAllowed;
|
this.passwordCredentialGrantAllowed = passwordCredentialGrantAllowed;
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean isRegistrationAllowed() {
|
public boolean isRegistrationAllowed() {
|
||||||
return registrationAllowed;
|
return registrationAllowed;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setRegistrationAllowed(boolean registrationAllowed) {
|
public void setRegistrationAllowed(boolean registrationAllowed) {
|
||||||
this.registrationAllowed = registrationAllowed;
|
this.registrationAllowed = registrationAllowed;
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean isRegistrationEmailAsUsername() {
|
public boolean isRegistrationEmailAsUsername() {
|
||||||
return registrationEmailAsUsername;
|
return registrationEmailAsUsername;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setRegistrationEmailAsUsername(boolean registrationEmailAsUsername) {
|
public void setRegistrationEmailAsUsername(boolean registrationEmailAsUsername) {
|
||||||
this.registrationEmailAsUsername = registrationEmailAsUsername;
|
this.registrationEmailAsUsername = registrationEmailAsUsername;
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean isRememberMe() {
|
public boolean isRememberMe() {
|
||||||
return rememberMe;
|
return rememberMe;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setRememberMe(boolean rememberMe) {
|
public void setRememberMe(boolean rememberMe) {
|
||||||
this.rememberMe = rememberMe;
|
this.rememberMe = rememberMe;
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean isVerifyEmail() {
|
public boolean isVerifyEmail() {
|
||||||
return verifyEmail;
|
return verifyEmail;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setVerifyEmail(boolean verifyEmail) {
|
public void setVerifyEmail(boolean verifyEmail) {
|
||||||
this.verifyEmail = verifyEmail;
|
this.verifyEmail = verifyEmail;
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean isResetPasswordAllowed() {
|
public boolean isResetPasswordAllowed() {
|
||||||
return resetPasswordAllowed;
|
return resetPasswordAllowed;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setResetPasswordAllowed(boolean resetPasswordAllowed) {
|
public void setResetPasswordAllowed(boolean resetPasswordAllowed) {
|
||||||
this.resetPasswordAllowed = resetPasswordAllowed;
|
this.resetPasswordAllowed = resetPasswordAllowed;
|
||||||
}
|
}
|
||||||
|
|
||||||
public int getSsoSessionIdleTimeout() {
|
public int getSsoSessionIdleTimeout() {
|
||||||
return ssoSessionIdleTimeout;
|
return ssoSessionIdleTimeout;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setSsoSessionIdleTimeout(int ssoSessionIdleTimeout) {
|
public void setSsoSessionIdleTimeout(int ssoSessionIdleTimeout) {
|
||||||
this.ssoSessionIdleTimeout = ssoSessionIdleTimeout;
|
this.ssoSessionIdleTimeout = ssoSessionIdleTimeout;
|
||||||
}
|
}
|
||||||
|
|
||||||
public int getSsoSessionMaxLifespan() {
|
public int getSsoSessionMaxLifespan() {
|
||||||
return ssoSessionMaxLifespan;
|
return ssoSessionMaxLifespan;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setSsoSessionMaxLifespan(int ssoSessionMaxLifespan) {
|
public void setSsoSessionMaxLifespan(int ssoSessionMaxLifespan) {
|
||||||
this.ssoSessionMaxLifespan = ssoSessionMaxLifespan;
|
this.ssoSessionMaxLifespan = ssoSessionMaxLifespan;
|
||||||
}
|
}
|
||||||
|
|
||||||
public int getAccessTokenLifespan() {
|
public int getAccessTokenLifespan() {
|
||||||
return accessTokenLifespan;
|
return accessTokenLifespan;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setAccessTokenLifespan(int accessTokenLifespan) {
|
public void setAccessTokenLifespan(int accessTokenLifespan) {
|
||||||
this.accessTokenLifespan = accessTokenLifespan;
|
this.accessTokenLifespan = accessTokenLifespan;
|
||||||
}
|
}
|
||||||
|
|
||||||
public int getAccessCodeLifespan() {
|
public int getAccessCodeLifespan() {
|
||||||
return accessCodeLifespan;
|
return accessCodeLifespan;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setAccessCodeLifespan(int accessCodeLifespan) {
|
public void setAccessCodeLifespan(int accessCodeLifespan) {
|
||||||
this.accessCodeLifespan = accessCodeLifespan;
|
this.accessCodeLifespan = accessCodeLifespan;
|
||||||
}
|
}
|
||||||
|
|
||||||
public int getAccessCodeLifespanUserAction() {
|
public int getAccessCodeLifespanUserAction() {
|
||||||
return accessCodeLifespanUserAction;
|
return accessCodeLifespanUserAction;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setAccessCodeLifespanUserAction(int accessCodeLifespanUserAction) {
|
public void setAccessCodeLifespanUserAction(int accessCodeLifespanUserAction) {
|
||||||
this.accessCodeLifespanUserAction = accessCodeLifespanUserAction;
|
this.accessCodeLifespanUserAction = accessCodeLifespanUserAction;
|
||||||
}
|
}
|
||||||
|
|
||||||
public int getAccessCodeLifespanLogin() {
|
public int getAccessCodeLifespanLogin() {
|
||||||
return accessCodeLifespanLogin;
|
return accessCodeLifespanLogin;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setAccessCodeLifespanLogin(int accessCodeLifespanLogin) {
|
public void setAccessCodeLifespanLogin(int accessCodeLifespanLogin) {
|
||||||
this.accessCodeLifespanLogin = accessCodeLifespanLogin;
|
this.accessCodeLifespanLogin = accessCodeLifespanLogin;
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getPublicKeyPem() {
|
public String getPublicKeyPem() {
|
||||||
return publicKeyPem;
|
return publicKeyPem;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setPublicKeyPem(String publicKeyPem) {
|
public void setPublicKeyPem(String publicKeyPem) {
|
||||||
this.publicKeyPem = publicKeyPem;
|
this.publicKeyPem = publicKeyPem;
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getPrivateKeyPem() {
|
public String getPrivateKeyPem() {
|
||||||
return privateKeyPem;
|
return privateKeyPem;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setPrivateKeyPem(String privateKeyPem) {
|
public void setPrivateKeyPem(String privateKeyPem) {
|
||||||
this.privateKeyPem = privateKeyPem;
|
this.privateKeyPem = privateKeyPem;
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getCodeSecret() {
|
public String getCodeSecret() {
|
||||||
return codeSecret;
|
return codeSecret;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setCodeSecret(String codeSecret) {
|
public void setCodeSecret(String codeSecret) {
|
||||||
this.codeSecret = codeSecret;
|
this.codeSecret = codeSecret;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Collection<RequiredCredentialEntity> getRequiredCredentials() {
|
public Collection<RequiredCredentialEntity> getRequiredCredentials() {
|
||||||
return requiredCredentials;
|
return requiredCredentials;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setRequiredCredentials(Collection<RequiredCredentialEntity> requiredCredentials) {
|
public void setRequiredCredentials(Collection<RequiredCredentialEntity> requiredCredentials) {
|
||||||
this.requiredCredentials = requiredCredentials;
|
this.requiredCredentials = requiredCredentials;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Collection<ApplicationEntity> getApplications() {
|
public Collection<ApplicationEntity> getApplications() {
|
||||||
return applications;
|
return applications;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setApplications(Collection<ApplicationEntity> applications) {
|
public void setApplications(Collection<ApplicationEntity> applications) {
|
||||||
this.applications = applications;
|
this.applications = applications;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Collection<RoleEntity> getRoles() {
|
public Collection<RoleEntity> getRoles() {
|
||||||
return roles;
|
return roles;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setRoles(Collection<RoleEntity> roles) {
|
public void setRoles(Collection<RoleEntity> roles) {
|
||||||
this.roles = roles;
|
this.roles = roles;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void addRole(RoleEntity role) {
|
public void addRole(RoleEntity role) {
|
||||||
if (roles == null) {
|
if (roles == null) {
|
||||||
roles = new ArrayList<RoleEntity>();
|
roles = new ArrayList<RoleEntity>();
|
||||||
}
|
}
|
||||||
roles.add(role);
|
roles.add(role);
|
||||||
}
|
}
|
||||||
|
|
||||||
public Map<String, String> getSmtpConfig() {
|
public Map<String, String> getSmtpConfig() {
|
||||||
return smtpConfig;
|
return smtpConfig;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setSmtpConfig(Map<String, String> smtpConfig) {
|
public void setSmtpConfig(Map<String, String> smtpConfig) {
|
||||||
this.smtpConfig = smtpConfig;
|
this.smtpConfig = smtpConfig;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Collection<RoleEntity> getDefaultRoles() {
|
public Collection<RoleEntity> getDefaultRoles() {
|
||||||
return defaultRoles;
|
return defaultRoles;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setDefaultRoles(Collection<RoleEntity> defaultRoles) {
|
public void setDefaultRoles(Collection<RoleEntity> defaultRoles) {
|
||||||
this.defaultRoles = defaultRoles;
|
this.defaultRoles = defaultRoles;
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getPasswordPolicy() {
|
public String getPasswordPolicy() {
|
||||||
return passwordPolicy;
|
return passwordPolicy;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setPasswordPolicy(String passwordPolicy) {
|
public void setPasswordPolicy(String passwordPolicy) {
|
||||||
this.passwordPolicy = passwordPolicy;
|
this.passwordPolicy = passwordPolicy;
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getLoginTheme() {
|
public String getLoginTheme() {
|
||||||
return loginTheme;
|
return loginTheme;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setLoginTheme(String theme) {
|
public void setLoginTheme(String theme) {
|
||||||
this.loginTheme = theme;
|
this.loginTheme = theme;
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getAccountTheme() {
|
public String getAccountTheme() {
|
||||||
return accountTheme;
|
return accountTheme;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setAccountTheme(String theme) {
|
public void setAccountTheme(String theme) {
|
||||||
this.accountTheme = theme;
|
this.accountTheme = theme;
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getAdminTheme() {
|
public String getAdminTheme() {
|
||||||
return adminTheme;
|
return adminTheme;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setAdminTheme(String adminTheme) {
|
public void setAdminTheme(String adminTheme) {
|
||||||
this.adminTheme = adminTheme;
|
this.adminTheme = adminTheme;
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getEmailTheme() {
|
public String getEmailTheme() {
|
||||||
return emailTheme;
|
return emailTheme;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setEmailTheme(String emailTheme) {
|
public void setEmailTheme(String emailTheme) {
|
||||||
this.emailTheme = emailTheme;
|
this.emailTheme = emailTheme;
|
||||||
}
|
}
|
||||||
|
|
||||||
public int getNotBefore() {
|
public int getNotBefore() {
|
||||||
return notBefore;
|
return notBefore;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setNotBefore(int notBefore) {
|
public void setNotBefore(int notBefore) {
|
||||||
this.notBefore = notBefore;
|
this.notBefore = notBefore;
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean isEventsEnabled() {
|
public boolean isEventsEnabled() {
|
||||||
return eventsEnabled;
|
return eventsEnabled;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setEventsEnabled(boolean eventsEnabled) {
|
public void setEventsEnabled(boolean eventsEnabled) {
|
||||||
this.eventsEnabled = eventsEnabled;
|
this.eventsEnabled = eventsEnabled;
|
||||||
}
|
}
|
||||||
|
|
||||||
public long getEventsExpiration() {
|
public long getEventsExpiration() {
|
||||||
return eventsExpiration;
|
return eventsExpiration;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setEventsExpiration(long eventsExpiration) {
|
public void setEventsExpiration(long eventsExpiration) {
|
||||||
this.eventsExpiration = eventsExpiration;
|
this.eventsExpiration = eventsExpiration;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Set<String> getEventsListeners() {
|
public Set<String> getEventsListeners() {
|
||||||
return eventsListeners;
|
return eventsListeners;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setEventsListeners(Set<String> eventsListeners) {
|
public void setEventsListeners(Set<String> eventsListeners) {
|
||||||
this.eventsListeners = eventsListeners;
|
this.eventsListeners = eventsListeners;
|
||||||
}
|
}
|
||||||
|
|
||||||
public ApplicationEntity getMasterAdminApp() {
|
public ApplicationEntity getMasterAdminApp() {
|
||||||
return masterAdminApp;
|
return masterAdminApp;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setMasterAdminApp(ApplicationEntity masterAdminApp) {
|
public void setMasterAdminApp(ApplicationEntity masterAdminApp) {
|
||||||
this.masterAdminApp = masterAdminApp;
|
this.masterAdminApp = masterAdminApp;
|
||||||
}
|
}
|
||||||
|
|
||||||
public List<UserFederationProviderEntity> getUserFederationProviders() {
|
public List<UserFederationProviderEntity> getUserFederationProviders() {
|
||||||
return userFederationProviders;
|
return userFederationProviders;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setUserFederationProviders(List<UserFederationProviderEntity> userFederationProviders) {
|
public void setUserFederationProviders(List<UserFederationProviderEntity> userFederationProviders) {
|
||||||
this.userFederationProviders = userFederationProviders;
|
this.userFederationProviders = userFederationProviders;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Collection<RealmAttributeEntity> getAttributes() {
|
public Collection<RealmAttributeEntity> getAttributes() {
|
||||||
return attributes;
|
return attributes;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setAttributes(Collection<RealmAttributeEntity> attributes) {
|
public void setAttributes(Collection<RealmAttributeEntity> attributes) {
|
||||||
this.attributes = attributes;
|
this.attributes = attributes;
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getCertificatePem() {
|
public String getCertificatePem() {
|
||||||
return certificatePem;
|
return certificatePem;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setCertificatePem(String certificatePem) {
|
public void setCertificatePem(String certificatePem) {
|
||||||
this.certificatePem = certificatePem;
|
this.certificatePem = certificatePem;
|
||||||
}
|
}
|
||||||
|
|
||||||
public List<IdentityProviderEntity> getIdentityProviders() {
|
public List<IdentityProviderEntity> getIdentityProviders() {
|
||||||
return this.identityProviders;
|
return this.identityProviders;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setIdentityProviders(List<IdentityProviderEntity> identityProviders) {
|
public void setIdentityProviders(List<IdentityProviderEntity> identityProviders) {
|
||||||
this.identityProviders = identityProviders;
|
this.identityProviders = identityProviders;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void addIdentityProvider(IdentityProviderEntity entity) {
|
public void addIdentityProvider(IdentityProviderEntity entity) {
|
||||||
entity.setRealm(this);
|
entity.setRealm(this);
|
||||||
getIdentityProviders().add(entity);
|
getIdentityProviders().add(entity);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
File diff suppressed because it is too large
Load diff
|
@ -21,59 +21,59 @@ import org.keycloak.representations.idm.CredentialRepresentation;
|
||||||
*/
|
*/
|
||||||
public class ApplianceBootstrap {
|
public class ApplianceBootstrap {
|
||||||
|
|
||||||
private static final Logger logger = Logger.getLogger(ApplianceBootstrap.class);
|
private static final Logger logger = Logger.getLogger(ApplianceBootstrap.class);
|
||||||
|
|
||||||
public void bootstrap(KeycloakSessionFactory sessionFactory, String contextPath) {
|
public void bootstrap(KeycloakSessionFactory sessionFactory, String contextPath) {
|
||||||
KeycloakSession session = sessionFactory.create();
|
KeycloakSession session = sessionFactory.create();
|
||||||
session.getTransaction().begin();
|
session.getTransaction().begin();
|
||||||
|
|
||||||
try {
|
try {
|
||||||
bootstrap(session, contextPath);
|
bootstrap(session, contextPath);
|
||||||
session.getTransaction().commit();
|
session.getTransaction().commit();
|
||||||
} finally {
|
} finally {
|
||||||
session.close();
|
session.close();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void bootstrap(KeycloakSession session, String contextPath) {
|
public void bootstrap(KeycloakSession session, String contextPath) {
|
||||||
String adminRealmName = Config.getAdminRealm();
|
String adminRealmName = Config.getAdminRealm();
|
||||||
if (session.realms().getRealm(adminRealmName) != null) {
|
if (session.realms().getRealm(adminRealmName) != null) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
logger.info("Initializing " + adminRealmName + " realm");
|
logger.info("Initializing " + adminRealmName + " realm");
|
||||||
|
|
||||||
RealmManager manager = new RealmManager(session);
|
RealmManager manager = new RealmManager(session);
|
||||||
manager.setContextPath(contextPath);
|
manager.setContextPath(contextPath);
|
||||||
RealmModel realm = manager.createRealm(adminRealmName, adminRealmName);
|
RealmModel realm = manager.createRealm(adminRealmName, adminRealmName);
|
||||||
realm.setName(adminRealmName);
|
realm.setName(adminRealmName);
|
||||||
realm.setEnabled(true);
|
realm.setEnabled(true);
|
||||||
realm.addRequiredCredential(CredentialRepresentation.PASSWORD);
|
realm.addRequiredCredential(CredentialRepresentation.PASSWORD);
|
||||||
realm.setSsoSessionIdleTimeout(1800);
|
realm.setSsoSessionIdleTimeout(1800);
|
||||||
realm.setAccessTokenLifespan(60);
|
realm.setAccessTokenLifespan(60);
|
||||||
realm.setSsoSessionMaxLifespan(36000);
|
realm.setSsoSessionMaxLifespan(36000);
|
||||||
realm.setAccessCodeLifespan(60);
|
realm.setAccessCodeLifespan(60);
|
||||||
realm.setAccessCodeLifespanUserAction(300);
|
realm.setAccessCodeLifespanUserAction(300);
|
||||||
realm.setSslRequired(SslRequired.EXTERNAL);
|
realm.setSslRequired(SslRequired.EXTERNAL);
|
||||||
realm.setRegistrationAllowed(false);
|
realm.setRegistrationAllowed(false);
|
||||||
realm.setRegistrationEmailAsUsername(false);
|
realm.setRegistrationEmailAsUsername(false);
|
||||||
KeycloakModelUtils.generateRealmKeys(realm);
|
KeycloakModelUtils.generateRealmKeys(realm);
|
||||||
|
|
||||||
UserModel adminUser = session.users().addUser(realm, "admin");
|
UserModel adminUser = session.users().addUser(realm, "admin");
|
||||||
adminUser.setEnabled(true);
|
adminUser.setEnabled(true);
|
||||||
UserCredentialModel password = new UserCredentialModel();
|
UserCredentialModel password = new UserCredentialModel();
|
||||||
password.setType(UserCredentialModel.PASSWORD);
|
password.setType(UserCredentialModel.PASSWORD);
|
||||||
password.setValue("admin");
|
password.setValue("admin");
|
||||||
session.users().updateCredential(realm, adminUser, password);
|
session.users().updateCredential(realm, adminUser, password);
|
||||||
adminUser.addRequiredAction(UserModel.RequiredAction.UPDATE_PASSWORD);
|
adminUser.addRequiredAction(UserModel.RequiredAction.UPDATE_PASSWORD);
|
||||||
|
|
||||||
RoleModel adminRole = realm.getRole(AdminRoles.ADMIN);
|
RoleModel adminRole = realm.getRole(AdminRoles.ADMIN);
|
||||||
adminUser.grantRole(adminRole);
|
adminUser.grantRole(adminRole);
|
||||||
|
|
||||||
ApplicationModel accountApp = realm.getApplicationNameMap().get(Constants.ACCOUNT_MANAGEMENT_APP);
|
ApplicationModel accountApp = realm.getApplicationNameMap().get(Constants.ACCOUNT_MANAGEMENT_APP);
|
||||||
for (String r : accountApp.getDefaultRoles()) {
|
for (String r : accountApp.getDefaultRoles()) {
|
||||||
adminUser.grantRole(accountApp.getRole(r));
|
adminUser.grantRole(accountApp.getRole(r));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
File diff suppressed because it is too large
Load diff
File diff suppressed because it is too large
Load diff
|
@ -12,75 +12,73 @@ import org.keycloak.services.messages.Messages;
|
||||||
|
|
||||||
public class Validation {
|
public class Validation {
|
||||||
|
|
||||||
// Actually allow same emails like angular. See ValidationTest.testEmailValidation()
|
// Actually allow same emails like angular. See ValidationTest.testEmailValidation()
|
||||||
private static final Pattern EMAIL_PATTERN = Pattern
|
private static final Pattern EMAIL_PATTERN = Pattern.compile("[a-zA-Z0-9!#$%&'*+/=?^_`{|}~.-]+@[a-zA-Z0-9-]+(\\.[a-zA-Z0-9-]+)*");
|
||||||
.compile("[a-zA-Z0-9!#$%&'*+/=?^_`{|}~.-]+@[a-zA-Z0-9-]+(\\.[a-zA-Z0-9-]+)*");
|
|
||||||
|
|
||||||
public static String validateRegistrationForm(RealmModel realm, MultivaluedMap<String, String> formData,
|
public static String validateRegistrationForm(RealmModel realm, MultivaluedMap<String, String> formData, List<String> requiredCredentialTypes) {
|
||||||
List<String> requiredCredentialTypes) {
|
if (isEmpty(formData.getFirst("firstName"))) {
|
||||||
if (isEmpty(formData.getFirst("firstName"))) {
|
return Messages.MISSING_FIRST_NAME;
|
||||||
return Messages.MISSING_FIRST_NAME;
|
}
|
||||||
}
|
|
||||||
|
|
||||||
if (isEmpty(formData.getFirst("lastName"))) {
|
if (isEmpty(formData.getFirst("lastName"))) {
|
||||||
return Messages.MISSING_LAST_NAME;
|
return Messages.MISSING_LAST_NAME;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (isEmpty(formData.getFirst("email"))) {
|
if (isEmpty(formData.getFirst("email"))) {
|
||||||
return Messages.MISSING_EMAIL;
|
return Messages.MISSING_EMAIL;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!isEmailValid(formData.getFirst("email"))) {
|
if (!isEmailValid(formData.getFirst("email"))) {
|
||||||
return Messages.INVALID_EMAIL;
|
return Messages.INVALID_EMAIL;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!realm.isRegistrationEmailAsUsername() && isEmpty(formData.getFirst("username"))) {
|
if (!realm.isRegistrationEmailAsUsername() && isEmpty(formData.getFirst("username"))) {
|
||||||
return Messages.MISSING_USERNAME;
|
return Messages.MISSING_USERNAME;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (requiredCredentialTypes.contains(CredentialRepresentation.PASSWORD)) {
|
if (requiredCredentialTypes.contains(CredentialRepresentation.PASSWORD)) {
|
||||||
if (isEmpty(formData.getFirst(CredentialRepresentation.PASSWORD))) {
|
if (isEmpty(formData.getFirst(CredentialRepresentation.PASSWORD))) {
|
||||||
return Messages.MISSING_PASSWORD;
|
return Messages.MISSING_PASSWORD;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!formData.getFirst("password").equals(formData.getFirst("password-confirm"))) {
|
if (!formData.getFirst("password").equals(formData.getFirst("password-confirm"))) {
|
||||||
return Messages.INVALID_PASSWORD_CONFIRM;
|
return Messages.INVALID_PASSWORD_CONFIRM;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static String validatePassword(MultivaluedMap<String, String> formData, PasswordPolicy policy) {
|
public static String validatePassword(MultivaluedMap<String, String> formData, PasswordPolicy policy) {
|
||||||
return policy.validate(formData.getFirst("password"));
|
return policy.validate(formData.getFirst("password"));
|
||||||
}
|
}
|
||||||
|
|
||||||
public static String validateUpdateProfileForm(MultivaluedMap<String, String> formData) {
|
public static String validateUpdateProfileForm(MultivaluedMap<String, String> formData) {
|
||||||
if (isEmpty(formData.getFirst("firstName"))) {
|
if (isEmpty(formData.getFirst("firstName"))) {
|
||||||
return Messages.MISSING_FIRST_NAME;
|
return Messages.MISSING_FIRST_NAME;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (isEmpty(formData.getFirst("lastName"))) {
|
if (isEmpty(formData.getFirst("lastName"))) {
|
||||||
return Messages.MISSING_LAST_NAME;
|
return Messages.MISSING_LAST_NAME;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (isEmpty(formData.getFirst("email"))) {
|
if (isEmpty(formData.getFirst("email"))) {
|
||||||
return Messages.MISSING_EMAIL;
|
return Messages.MISSING_EMAIL;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!isEmailValid(formData.getFirst("email"))) {
|
if (!isEmailValid(formData.getFirst("email"))) {
|
||||||
return Messages.INVALID_EMAIL;
|
return Messages.INVALID_EMAIL;
|
||||||
}
|
}
|
||||||
|
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static boolean isEmpty(String s) {
|
public static boolean isEmpty(String s) {
|
||||||
return s == null || s.length() == 0;
|
return s == null || s.length() == 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static boolean isEmailValid(String email) {
|
public static boolean isEmailValid(String email) {
|
||||||
return EMAIL_PATTERN.matcher(email).matches();
|
return EMAIL_PATTERN.matcher(email).matches();
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -63,268 +63,265 @@ import org.keycloak.testutils.KeycloakServer;
|
||||||
*/
|
*/
|
||||||
public class AdminAPITest {
|
public class AdminAPITest {
|
||||||
|
|
||||||
@ClassRule
|
@ClassRule
|
||||||
public static AbstractKeycloakRule keycloakRule = new AbstractKeycloakRule() {
|
public static AbstractKeycloakRule keycloakRule = new AbstractKeycloakRule() {
|
||||||
@Override
|
@Override
|
||||||
protected void configure(KeycloakSession session, RealmManager manager, RealmModel adminRealm) {
|
protected void configure(KeycloakSession session, RealmManager manager, RealmModel adminRealm) {
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
private static String createToken() {
|
private static String createToken() {
|
||||||
KeycloakSession session = keycloakRule.startSession();
|
KeycloakSession session = keycloakRule.startSession();
|
||||||
try {
|
try {
|
||||||
RealmManager manager = new RealmManager(session);
|
RealmManager manager = new RealmManager(session);
|
||||||
|
|
||||||
RealmModel adminRealm = manager.getRealm(Config.getAdminRealm());
|
RealmModel adminRealm = manager.getRealm(Config.getAdminRealm());
|
||||||
ApplicationModel adminConsole = adminRealm.getApplicationByName(Constants.ADMIN_CONSOLE_APPLICATION);
|
ApplicationModel adminConsole = adminRealm.getApplicationByName(Constants.ADMIN_CONSOLE_APPLICATION);
|
||||||
TokenManager tm = new TokenManager();
|
TokenManager tm = new TokenManager();
|
||||||
UserModel admin = session.users().getUserByUsername("admin", adminRealm);
|
UserModel admin = session.users().getUserByUsername("admin", adminRealm);
|
||||||
UserSessionModel userSession = session.sessions().createUserSession(adminRealm, admin, "admin", null, "form",
|
UserSessionModel userSession = session.sessions().createUserSession(adminRealm, admin, "admin", null, "form", false);
|
||||||
false);
|
AccessToken token = tm.createClientAccessToken(session, tm.getAccess(null, adminConsole, admin), adminRealm, adminConsole, admin, userSession, null);
|
||||||
AccessToken token = tm.createClientAccessToken(session, tm.getAccess(null, adminConsole, admin), adminRealm,
|
return tm.encodeToken(adminRealm, token);
|
||||||
adminConsole, admin, userSession, null);
|
} finally {
|
||||||
return tm.encodeToken(adminRealm, token);
|
keycloakRule.stopSession(session, true);
|
||||||
} finally {
|
}
|
||||||
keycloakRule.stopSession(session, true);
|
}
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
protected void testCreateRealm(RealmRepresentation rep) {
|
protected void testCreateRealm(RealmRepresentation rep) {
|
||||||
String token = createToken();
|
String token = createToken();
|
||||||
final String authHeader = "Bearer " + token;
|
final String authHeader = "Bearer " + token;
|
||||||
ClientRequestFilter authFilter = new ClientRequestFilter() {
|
ClientRequestFilter authFilter = new ClientRequestFilter() {
|
||||||
@Override
|
@Override
|
||||||
public void filter(ClientRequestContext requestContext) throws IOException {
|
public void filter(ClientRequestContext requestContext) throws IOException {
|
||||||
requestContext.getHeaders().add(HttpHeaders.AUTHORIZATION, authHeader);
|
requestContext.getHeaders().add(HttpHeaders.AUTHORIZATION, authHeader);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
Client client = ClientBuilder.newBuilder().register(authFilter).build();
|
Client client = ClientBuilder.newBuilder().register(authFilter).build();
|
||||||
UriBuilder authBase = UriBuilder.fromUri("http://localhost:8081/auth");
|
UriBuilder authBase = UriBuilder.fromUri("http://localhost:8081/auth");
|
||||||
WebTarget adminRealms = client.target(AdminRoot.realmsUrl(authBase));
|
WebTarget adminRealms = client.target(AdminRoot.realmsUrl(authBase));
|
||||||
String realmName = rep.getRealm();
|
String realmName = rep.getRealm();
|
||||||
WebTarget realmTarget = adminRealms.path(realmName);
|
WebTarget realmTarget = adminRealms.path(realmName);
|
||||||
|
|
||||||
// create with just name, enabled, and id, just like admin console
|
// create with just name, enabled, and id, just like admin console
|
||||||
RealmRepresentation newRep = new RealmRepresentation();
|
RealmRepresentation newRep = new RealmRepresentation();
|
||||||
newRep.setRealm(rep.getRealm());
|
newRep.setRealm(rep.getRealm());
|
||||||
newRep.setEnabled(rep.isEnabled());
|
newRep.setEnabled(rep.isEnabled());
|
||||||
{
|
{
|
||||||
Response response = adminRealms.request().post(Entity.json(newRep));
|
Response response = adminRealms.request().post(Entity.json(newRep));
|
||||||
Assert.assertEquals(201, response.getStatus());
|
Assert.assertEquals(201, response.getStatus());
|
||||||
response.close();
|
response.close();
|
||||||
}
|
}
|
||||||
// todo test with full import with initial create
|
// todo test with full import with initial create
|
||||||
RealmRepresentation storedRealm = realmTarget.request().get(RealmRepresentation.class);
|
RealmRepresentation storedRealm = realmTarget.request().get(RealmRepresentation.class);
|
||||||
checkRealmRep(newRep, storedRealm);
|
checkRealmRep(newRep, storedRealm);
|
||||||
|
|
||||||
Response updateResponse = realmTarget.request().put(Entity.json(rep));
|
Response updateResponse = realmTarget.request().put(Entity.json(rep));
|
||||||
Assert.assertEquals(204, updateResponse.getStatus());
|
Assert.assertEquals(204, updateResponse.getStatus());
|
||||||
updateResponse.close();
|
updateResponse.close();
|
||||||
storedRealm = realmTarget.request().get(RealmRepresentation.class);
|
storedRealm = realmTarget.request().get(RealmRepresentation.class);
|
||||||
checkRealmRep(rep, storedRealm);
|
checkRealmRep(rep, storedRealm);
|
||||||
|
|
||||||
if (rep.getApplications() != null) {
|
if (rep.getApplications() != null) {
|
||||||
WebTarget applicationsTarget = realmTarget.path("applications");
|
WebTarget applicationsTarget = realmTarget.path("applications");
|
||||||
for (ApplicationRepresentation appRep : rep.getApplications()) {
|
for (ApplicationRepresentation appRep : rep.getApplications()) {
|
||||||
ApplicationRepresentation newApp = new ApplicationRepresentation();
|
ApplicationRepresentation newApp = new ApplicationRepresentation();
|
||||||
if (appRep.getId() != null)
|
if (appRep.getId() != null)
|
||||||
newApp.setId(appRep.getId());
|
newApp.setId(appRep.getId());
|
||||||
newApp.setName(appRep.getName());
|
newApp.setName(appRep.getName());
|
||||||
if (appRep.getSecret() != null) {
|
if (appRep.getSecret() != null) {
|
||||||
newApp.setSecret(appRep.getSecret());
|
newApp.setSecret(appRep.getSecret());
|
||||||
}
|
}
|
||||||
Response appCreateResponse = applicationsTarget.request().post(Entity.json(newApp));
|
Response appCreateResponse = applicationsTarget.request().post(Entity.json(newApp));
|
||||||
Assert.assertEquals(201, appCreateResponse.getStatus());
|
Assert.assertEquals(201, appCreateResponse.getStatus());
|
||||||
appCreateResponse.close();
|
appCreateResponse.close();
|
||||||
WebTarget appTarget = applicationsTarget.path(appRep.getName());
|
WebTarget appTarget = applicationsTarget.path(appRep.getName());
|
||||||
CredentialRepresentation cred = appTarget.path("client-secret").request().get(CredentialRepresentation.class);
|
CredentialRepresentation cred = appTarget.path("client-secret").request().get(CredentialRepresentation.class);
|
||||||
if (appRep.getSecret() != null)
|
if (appRep.getSecret() != null)
|
||||||
Assert.assertEquals(appRep.getSecret(), cred.getValue());
|
Assert.assertEquals(appRep.getSecret(), cred.getValue());
|
||||||
CredentialRepresentation newCred = appTarget.path("client-secret").request()
|
CredentialRepresentation newCred = appTarget.path("client-secret").request().post(null, CredentialRepresentation.class);
|
||||||
.post(null, CredentialRepresentation.class);
|
Assert.assertNotEquals(newCred.getValue(), cred.getValue());
|
||||||
Assert.assertNotEquals(newCred.getValue(), cred.getValue());
|
|
||||||
|
|
||||||
Response appUpdateResponse = appTarget.request().put(Entity.json(appRep));
|
Response appUpdateResponse = appTarget.request().put(Entity.json(appRep));
|
||||||
Assert.assertEquals(204, appUpdateResponse.getStatus());
|
Assert.assertEquals(204, appUpdateResponse.getStatus());
|
||||||
appUpdateResponse.close();
|
appUpdateResponse.close();
|
||||||
|
|
||||||
ApplicationRepresentation storedApp = appTarget.request().get(ApplicationRepresentation.class);
|
ApplicationRepresentation storedApp = appTarget.request().get(ApplicationRepresentation.class);
|
||||||
|
|
||||||
checkAppUpdate(appRep, storedApp);
|
checkAppUpdate(appRep, storedApp);
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// delete realm
|
// delete realm
|
||||||
{
|
{
|
||||||
Response response = adminRealms.path(realmName).request().delete();
|
Response response = adminRealms.path(realmName).request().delete();
|
||||||
Assert.assertEquals(204, response.getStatus());
|
Assert.assertEquals(204, response.getStatus());
|
||||||
response.close();
|
response.close();
|
||||||
|
|
||||||
}
|
}
|
||||||
client.close();
|
client.close();
|
||||||
}
|
}
|
||||||
|
|
||||||
protected void checkAppUpdate(ApplicationRepresentation appRep, ApplicationRepresentation storedApp) {
|
protected void checkAppUpdate(ApplicationRepresentation appRep, ApplicationRepresentation storedApp) {
|
||||||
if (appRep.getName() != null)
|
if (appRep.getName() != null)
|
||||||
Assert.assertEquals(appRep.getName(), storedApp.getName());
|
Assert.assertEquals(appRep.getName(), storedApp.getName());
|
||||||
if (appRep.isEnabled() != null)
|
if (appRep.isEnabled() != null)
|
||||||
Assert.assertEquals(appRep.isEnabled(), storedApp.isEnabled());
|
Assert.assertEquals(appRep.isEnabled(), storedApp.isEnabled());
|
||||||
if (appRep.isBearerOnly() != null)
|
if (appRep.isBearerOnly() != null)
|
||||||
Assert.assertEquals(appRep.isBearerOnly(), storedApp.isBearerOnly());
|
Assert.assertEquals(appRep.isBearerOnly(), storedApp.isBearerOnly());
|
||||||
if (appRep.isPublicClient() != null)
|
if (appRep.isPublicClient() != null)
|
||||||
Assert.assertEquals(appRep.isPublicClient(), storedApp.isPublicClient());
|
Assert.assertEquals(appRep.isPublicClient(), storedApp.isPublicClient());
|
||||||
if (appRep.isFullScopeAllowed() != null)
|
if (appRep.isFullScopeAllowed() != null)
|
||||||
Assert.assertEquals(appRep.isFullScopeAllowed(), storedApp.isFullScopeAllowed());
|
Assert.assertEquals(appRep.isFullScopeAllowed(), storedApp.isFullScopeAllowed());
|
||||||
if (appRep.getAdminUrl() != null)
|
if (appRep.getAdminUrl() != null)
|
||||||
Assert.assertEquals(appRep.getAdminUrl(), storedApp.getAdminUrl());
|
Assert.assertEquals(appRep.getAdminUrl(), storedApp.getAdminUrl());
|
||||||
if (appRep.getBaseUrl() != null)
|
if (appRep.getBaseUrl() != null)
|
||||||
Assert.assertEquals(appRep.getBaseUrl(), storedApp.getBaseUrl());
|
Assert.assertEquals(appRep.getBaseUrl(), storedApp.getBaseUrl());
|
||||||
if (appRep.isSurrogateAuthRequired() != null)
|
if (appRep.isSurrogateAuthRequired() != null)
|
||||||
Assert.assertEquals(appRep.isSurrogateAuthRequired(), storedApp.isSurrogateAuthRequired());
|
Assert.assertEquals(appRep.isSurrogateAuthRequired(), storedApp.isSurrogateAuthRequired());
|
||||||
|
|
||||||
if (appRep.getNotBefore() != null) {
|
if (appRep.getNotBefore() != null) {
|
||||||
Assert.assertEquals(appRep.getNotBefore(), storedApp.getNotBefore());
|
Assert.assertEquals(appRep.getNotBefore(), storedApp.getNotBefore());
|
||||||
}
|
}
|
||||||
if (appRep.getDefaultRoles() != null) {
|
if (appRep.getDefaultRoles() != null) {
|
||||||
Set<String> set = new HashSet<String>();
|
Set<String> set = new HashSet<String>();
|
||||||
for (String val : appRep.getDefaultRoles()) {
|
for (String val : appRep.getDefaultRoles()) {
|
||||||
set.add(val);
|
set.add(val);
|
||||||
}
|
}
|
||||||
Set<String> storedSet = new HashSet<String>();
|
Set<String> storedSet = new HashSet<String>();
|
||||||
for (String val : storedApp.getDefaultRoles()) {
|
for (String val : storedApp.getDefaultRoles()) {
|
||||||
storedSet.add(val);
|
storedSet.add(val);
|
||||||
}
|
}
|
||||||
|
|
||||||
Assert.assertEquals(set, storedSet);
|
Assert.assertEquals(set, storedSet);
|
||||||
}
|
}
|
||||||
|
|
||||||
List<String> redirectUris = appRep.getRedirectUris();
|
List<String> redirectUris = appRep.getRedirectUris();
|
||||||
if (redirectUris != null) {
|
if (redirectUris != null) {
|
||||||
Set<String> set = new HashSet<String>();
|
Set<String> set = new HashSet<String>();
|
||||||
for (String val : appRep.getRedirectUris()) {
|
for (String val : appRep.getRedirectUris()) {
|
||||||
set.add(val);
|
set.add(val);
|
||||||
}
|
}
|
||||||
Set<String> storedSet = new HashSet<String>();
|
Set<String> storedSet = new HashSet<String>();
|
||||||
for (String val : storedApp.getRedirectUris()) {
|
for (String val : storedApp.getRedirectUris()) {
|
||||||
storedSet.add(val);
|
storedSet.add(val);
|
||||||
}
|
}
|
||||||
|
|
||||||
Assert.assertEquals(set, storedSet);
|
Assert.assertEquals(set, storedSet);
|
||||||
}
|
}
|
||||||
|
|
||||||
List<String> webOrigins = appRep.getWebOrigins();
|
List<String> webOrigins = appRep.getWebOrigins();
|
||||||
if (webOrigins != null) {
|
if (webOrigins != null) {
|
||||||
Set<String> set = new HashSet<String>();
|
Set<String> set = new HashSet<String>();
|
||||||
for (String val : appRep.getWebOrigins()) {
|
for (String val : appRep.getWebOrigins()) {
|
||||||
set.add(val);
|
set.add(val);
|
||||||
}
|
}
|
||||||
Set<String> storedSet = new HashSet<String>();
|
Set<String> storedSet = new HashSet<String>();
|
||||||
for (String val : storedApp.getWebOrigins()) {
|
for (String val : storedApp.getWebOrigins()) {
|
||||||
storedSet.add(val);
|
storedSet.add(val);
|
||||||
}
|
}
|
||||||
|
|
||||||
Assert.assertEquals(set, storedSet);
|
Assert.assertEquals(set, storedSet);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
protected void checkRealmRep(RealmRepresentation rep, RealmRepresentation storedRealm) {
|
protected void checkRealmRep(RealmRepresentation rep, RealmRepresentation storedRealm) {
|
||||||
if (rep.getId() != null) {
|
if (rep.getId() != null) {
|
||||||
Assert.assertEquals(rep.getId(), storedRealm.getId());
|
Assert.assertEquals(rep.getId(), storedRealm.getId());
|
||||||
}
|
}
|
||||||
if (rep.getRealm() != null) {
|
if (rep.getRealm() != null) {
|
||||||
Assert.assertEquals(rep.getRealm(), storedRealm.getRealm());
|
Assert.assertEquals(rep.getRealm(), storedRealm.getRealm());
|
||||||
}
|
}
|
||||||
if (rep.isEnabled() != null)
|
if (rep.isEnabled() != null)
|
||||||
Assert.assertEquals(rep.isEnabled(), storedRealm.isEnabled());
|
Assert.assertEquals(rep.isEnabled(), storedRealm.isEnabled());
|
||||||
if (rep.isBruteForceProtected() != null)
|
if (rep.isBruteForceProtected() != null)
|
||||||
Assert.assertEquals(rep.isBruteForceProtected(), storedRealm.isBruteForceProtected());
|
Assert.assertEquals(rep.isBruteForceProtected(), storedRealm.isBruteForceProtected());
|
||||||
if (rep.getMaxFailureWaitSeconds() != null)
|
if (rep.getMaxFailureWaitSeconds() != null)
|
||||||
Assert.assertEquals(rep.getMaxFailureWaitSeconds(), storedRealm.getMaxFailureWaitSeconds());
|
Assert.assertEquals(rep.getMaxFailureWaitSeconds(), storedRealm.getMaxFailureWaitSeconds());
|
||||||
if (rep.getMinimumQuickLoginWaitSeconds() != null)
|
if (rep.getMinimumQuickLoginWaitSeconds() != null)
|
||||||
Assert.assertEquals(rep.getMinimumQuickLoginWaitSeconds(), storedRealm.getMinimumQuickLoginWaitSeconds());
|
Assert.assertEquals(rep.getMinimumQuickLoginWaitSeconds(), storedRealm.getMinimumQuickLoginWaitSeconds());
|
||||||
if (rep.getWaitIncrementSeconds() != null)
|
if (rep.getWaitIncrementSeconds() != null)
|
||||||
Assert.assertEquals(rep.getWaitIncrementSeconds(), storedRealm.getWaitIncrementSeconds());
|
Assert.assertEquals(rep.getWaitIncrementSeconds(), storedRealm.getWaitIncrementSeconds());
|
||||||
if (rep.getQuickLoginCheckMilliSeconds() != null)
|
if (rep.getQuickLoginCheckMilliSeconds() != null)
|
||||||
Assert.assertEquals(rep.getQuickLoginCheckMilliSeconds(), storedRealm.getQuickLoginCheckMilliSeconds());
|
Assert.assertEquals(rep.getQuickLoginCheckMilliSeconds(), storedRealm.getQuickLoginCheckMilliSeconds());
|
||||||
if (rep.getMaxDeltaTimeSeconds() != null)
|
if (rep.getMaxDeltaTimeSeconds() != null)
|
||||||
Assert.assertEquals(rep.getMaxDeltaTimeSeconds(), storedRealm.getMaxDeltaTimeSeconds());
|
Assert.assertEquals(rep.getMaxDeltaTimeSeconds(), storedRealm.getMaxDeltaTimeSeconds());
|
||||||
if (rep.getFailureFactor() != null)
|
if (rep.getFailureFactor() != null)
|
||||||
Assert.assertEquals(rep.getFailureFactor(), storedRealm.getFailureFactor());
|
Assert.assertEquals(rep.getFailureFactor(), storedRealm.getFailureFactor());
|
||||||
if (rep.isPasswordCredentialGrantAllowed() != null)
|
if (rep.isPasswordCredentialGrantAllowed() != null)
|
||||||
Assert.assertEquals(rep.isPasswordCredentialGrantAllowed(), storedRealm.isPasswordCredentialGrantAllowed());
|
Assert.assertEquals(rep.isPasswordCredentialGrantAllowed(), storedRealm.isPasswordCredentialGrantAllowed());
|
||||||
if (rep.isRegistrationAllowed() != null)
|
if (rep.isRegistrationAllowed() != null)
|
||||||
Assert.assertEquals(rep.isRegistrationAllowed(), storedRealm.isRegistrationAllowed());
|
Assert.assertEquals(rep.isRegistrationAllowed(), storedRealm.isRegistrationAllowed());
|
||||||
if (rep.isRegistrationEmailAsUsername() != null)
|
if (rep.isRegistrationEmailAsUsername() != null)
|
||||||
Assert.assertEquals(rep.isRegistrationEmailAsUsername(), storedRealm.isRegistrationEmailAsUsername());
|
Assert.assertEquals(rep.isRegistrationEmailAsUsername(), storedRealm.isRegistrationEmailAsUsername());
|
||||||
if (rep.isRememberMe() != null)
|
if (rep.isRememberMe() != null)
|
||||||
Assert.assertEquals(rep.isRememberMe(), storedRealm.isRememberMe());
|
Assert.assertEquals(rep.isRememberMe(), storedRealm.isRememberMe());
|
||||||
if (rep.isVerifyEmail() != null)
|
if (rep.isVerifyEmail() != null)
|
||||||
Assert.assertEquals(rep.isVerifyEmail(), storedRealm.isVerifyEmail());
|
Assert.assertEquals(rep.isVerifyEmail(), storedRealm.isVerifyEmail());
|
||||||
if (rep.isResetPasswordAllowed() != null)
|
if (rep.isResetPasswordAllowed() != null)
|
||||||
Assert.assertEquals(rep.isResetPasswordAllowed(), storedRealm.isResetPasswordAllowed());
|
Assert.assertEquals(rep.isResetPasswordAllowed(), storedRealm.isResetPasswordAllowed());
|
||||||
if (rep.getSslRequired() != null)
|
if (rep.getSslRequired() != null)
|
||||||
Assert.assertEquals(rep.getSslRequired(), storedRealm.getSslRequired());
|
Assert.assertEquals(rep.getSslRequired(), storedRealm.getSslRequired());
|
||||||
if (rep.getAccessCodeLifespan() != null)
|
if (rep.getAccessCodeLifespan() != null)
|
||||||
Assert.assertEquals(rep.getAccessCodeLifespan(), storedRealm.getAccessCodeLifespan());
|
Assert.assertEquals(rep.getAccessCodeLifespan(), storedRealm.getAccessCodeLifespan());
|
||||||
if (rep.getAccessCodeLifespanUserAction() != null)
|
if (rep.getAccessCodeLifespanUserAction() != null)
|
||||||
Assert.assertEquals(rep.getAccessCodeLifespanUserAction(), storedRealm.getAccessCodeLifespanUserAction());
|
Assert.assertEquals(rep.getAccessCodeLifespanUserAction(), storedRealm.getAccessCodeLifespanUserAction());
|
||||||
if (rep.getNotBefore() != null)
|
if (rep.getNotBefore() != null)
|
||||||
Assert.assertEquals(rep.getNotBefore(), storedRealm.getNotBefore());
|
Assert.assertEquals(rep.getNotBefore(), storedRealm.getNotBefore());
|
||||||
if (rep.getAccessTokenLifespan() != null)
|
if (rep.getAccessTokenLifespan() != null)
|
||||||
Assert.assertEquals(rep.getAccessTokenLifespan(), storedRealm.getAccessTokenLifespan());
|
Assert.assertEquals(rep.getAccessTokenLifespan(), storedRealm.getAccessTokenLifespan());
|
||||||
if (rep.getSsoSessionIdleTimeout() != null)
|
if (rep.getSsoSessionIdleTimeout() != null)
|
||||||
Assert.assertEquals(rep.getSsoSessionIdleTimeout(), storedRealm.getSsoSessionIdleTimeout());
|
Assert.assertEquals(rep.getSsoSessionIdleTimeout(), storedRealm.getSsoSessionIdleTimeout());
|
||||||
if (rep.getSsoSessionMaxLifespan() != null)
|
if (rep.getSsoSessionMaxLifespan() != null)
|
||||||
Assert.assertEquals(rep.getSsoSessionMaxLifespan(), storedRealm.getSsoSessionMaxLifespan());
|
Assert.assertEquals(rep.getSsoSessionMaxLifespan(), storedRealm.getSsoSessionMaxLifespan());
|
||||||
if (rep.getRequiredCredentials() != null) {
|
if (rep.getRequiredCredentials() != null) {
|
||||||
Assert.assertNotNull(storedRealm.getRequiredCredentials());
|
Assert.assertNotNull(storedRealm.getRequiredCredentials());
|
||||||
for (String cred : rep.getRequiredCredentials()) {
|
for (String cred : rep.getRequiredCredentials()) {
|
||||||
Assert.assertTrue(storedRealm.getRequiredCredentials().contains(cred));
|
Assert.assertTrue(storedRealm.getRequiredCredentials().contains(cred));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (rep.getLoginTheme() != null)
|
if (rep.getLoginTheme() != null)
|
||||||
Assert.assertEquals(rep.getLoginTheme(), storedRealm.getLoginTheme());
|
Assert.assertEquals(rep.getLoginTheme(), storedRealm.getLoginTheme());
|
||||||
if (rep.getAccountTheme() != null)
|
if (rep.getAccountTheme() != null)
|
||||||
Assert.assertEquals(rep.getAccountTheme(), storedRealm.getAccountTheme());
|
Assert.assertEquals(rep.getAccountTheme(), storedRealm.getAccountTheme());
|
||||||
if (rep.getAdminTheme() != null)
|
if (rep.getAdminTheme() != null)
|
||||||
Assert.assertEquals(rep.getAdminTheme(), storedRealm.getAdminTheme());
|
Assert.assertEquals(rep.getAdminTheme(), storedRealm.getAdminTheme());
|
||||||
if (rep.getEmailTheme() != null)
|
if (rep.getEmailTheme() != null)
|
||||||
Assert.assertEquals(rep.getEmailTheme(), storedRealm.getEmailTheme());
|
Assert.assertEquals(rep.getEmailTheme(), storedRealm.getEmailTheme());
|
||||||
|
|
||||||
if (rep.getPasswordPolicy() != null)
|
if (rep.getPasswordPolicy() != null)
|
||||||
Assert.assertEquals(rep.getPasswordPolicy(), storedRealm.getPasswordPolicy());
|
Assert.assertEquals(rep.getPasswordPolicy(), storedRealm.getPasswordPolicy());
|
||||||
|
|
||||||
if (rep.getDefaultRoles() != null) {
|
if (rep.getDefaultRoles() != null) {
|
||||||
Assert.assertNotNull(storedRealm.getDefaultRoles());
|
Assert.assertNotNull(storedRealm.getDefaultRoles());
|
||||||
for (String role : rep.getDefaultRoles()) {
|
for (String role : rep.getDefaultRoles()) {
|
||||||
Assert.assertTrue(storedRealm.getDefaultRoles().contains(role));
|
Assert.assertTrue(storedRealm.getDefaultRoles().contains(role));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (rep.getSmtpServer() != null) {
|
if (rep.getSmtpServer() != null) {
|
||||||
Assert.assertEquals(rep.getSmtpServer(), storedRealm.getSmtpServer());
|
Assert.assertEquals(rep.getSmtpServer(), storedRealm.getSmtpServer());
|
||||||
}
|
}
|
||||||
|
|
||||||
if (rep.getBrowserSecurityHeaders() != null) {
|
if (rep.getBrowserSecurityHeaders() != null) {
|
||||||
Assert.assertEquals(rep.getBrowserSecurityHeaders(), storedRealm.getBrowserSecurityHeaders());
|
Assert.assertEquals(rep.getBrowserSecurityHeaders(), storedRealm.getBrowserSecurityHeaders());
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
protected void testCreateRealm(String path) {
|
protected void testCreateRealm(String path) {
|
||||||
RealmRepresentation rep = KeycloakServer.loadJson(getClass().getResourceAsStream(path), RealmRepresentation.class);
|
RealmRepresentation rep = KeycloakServer.loadJson(getClass().getResourceAsStream(path), RealmRepresentation.class);
|
||||||
Assert.assertNotNull(rep);
|
Assert.assertNotNull(rep);
|
||||||
testCreateRealm(rep);
|
testCreateRealm(rep);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testAdminApi() {
|
public void testAdminApi() {
|
||||||
RealmRepresentation empty = new RealmRepresentation();
|
RealmRepresentation empty = new RealmRepresentation();
|
||||||
empty.setEnabled(true);
|
empty.setEnabled(true);
|
||||||
empty.setRealm("empty");
|
empty.setRealm("empty");
|
||||||
testCreateRealm(empty);
|
testCreateRealm(empty);
|
||||||
testCreateRealm("/admin-test/testrealm.json");
|
testCreateRealm("/admin-test/testrealm.json");
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -13,65 +13,65 @@ import org.keycloak.representations.idm.RealmRepresentation;
|
||||||
|
|
||||||
public class ModelTest extends AbstractModelTest {
|
public class ModelTest extends AbstractModelTest {
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void importExportRealm() {
|
public void importExportRealm() {
|
||||||
RealmModel realm = realmManager.createRealm("original");
|
RealmModel realm = realmManager.createRealm("original");
|
||||||
realm.setRegistrationAllowed(true);
|
realm.setRegistrationAllowed(true);
|
||||||
realm.setRegistrationEmailAsUsername(true);
|
realm.setRegistrationEmailAsUsername(true);
|
||||||
realm.setResetPasswordAllowed(true);
|
realm.setResetPasswordAllowed(true);
|
||||||
realm.setSslRequired(SslRequired.EXTERNAL);
|
realm.setSslRequired(SslRequired.EXTERNAL);
|
||||||
realm.setVerifyEmail(true);
|
realm.setVerifyEmail(true);
|
||||||
realm.setAccessTokenLifespan(1000);
|
realm.setAccessTokenLifespan(1000);
|
||||||
realm.setPasswordPolicy(new PasswordPolicy("length"));
|
realm.setPasswordPolicy(new PasswordPolicy("length"));
|
||||||
realm.setAccessCodeLifespan(1001);
|
realm.setAccessCodeLifespan(1001);
|
||||||
realm.setAccessCodeLifespanUserAction(1002);
|
realm.setAccessCodeLifespanUserAction(1002);
|
||||||
KeycloakModelUtils.generateRealmKeys(realm);
|
KeycloakModelUtils.generateRealmKeys(realm);
|
||||||
realm.addDefaultRole("default-role");
|
realm.addDefaultRole("default-role");
|
||||||
|
|
||||||
HashMap<String, String> smtp = new HashMap<String, String>();
|
HashMap<String, String> smtp = new HashMap<String, String>();
|
||||||
smtp.put("from", "auto@keycloak");
|
smtp.put("from", "auto@keycloak");
|
||||||
smtp.put("hostname", "localhost");
|
smtp.put("hostname", "localhost");
|
||||||
realm.setSmtpConfig(smtp);
|
realm.setSmtpConfig(smtp);
|
||||||
|
|
||||||
HashMap<String, String> social = new HashMap<String, String>();
|
HashMap<String, String> social = new HashMap<String, String>();
|
||||||
social.put("google.key", "1234");
|
social.put("google.key", "1234");
|
||||||
social.put("google.secret", "5678");
|
social.put("google.secret", "5678");
|
||||||
// FIXME: KEYCLOAK-883
|
// FIXME: KEYCLOAK-883
|
||||||
// realm.setSocialConfig(social);
|
// realm.setSocialConfig(social);
|
||||||
|
|
||||||
RealmModel persisted = realmManager.getRealm(realm.getId());
|
RealmModel persisted = realmManager.getRealm(realm.getId());
|
||||||
assertEquals(realm, persisted);
|
assertEquals(realm, persisted);
|
||||||
|
|
||||||
RealmModel copy = importExport(realm, "copy");
|
RealmModel copy = importExport(realm, "copy");
|
||||||
assertEquals(realm, copy);
|
assertEquals(realm, copy);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void assertEquals(RealmModel expected, RealmModel actual) {
|
public static void assertEquals(RealmModel expected, RealmModel actual) {
|
||||||
Assert.assertEquals(expected.isRegistrationAllowed(), actual.isRegistrationAllowed());
|
Assert.assertEquals(expected.isRegistrationAllowed(), actual.isRegistrationAllowed());
|
||||||
Assert.assertEquals(expected.isRegistrationEmailAsUsername(), actual.isRegistrationEmailAsUsername());
|
Assert.assertEquals(expected.isRegistrationEmailAsUsername(), actual.isRegistrationEmailAsUsername());
|
||||||
Assert.assertEquals(expected.isResetPasswordAllowed(), actual.isResetPasswordAllowed());
|
Assert.assertEquals(expected.isResetPasswordAllowed(), actual.isResetPasswordAllowed());
|
||||||
Assert.assertEquals(expected.getSslRequired(), actual.getSslRequired());
|
Assert.assertEquals(expected.getSslRequired(), actual.getSslRequired());
|
||||||
Assert.assertEquals(expected.isVerifyEmail(), actual.isVerifyEmail());
|
Assert.assertEquals(expected.isVerifyEmail(), actual.isVerifyEmail());
|
||||||
Assert.assertEquals(expected.getAccessTokenLifespan(), actual.getAccessTokenLifespan());
|
Assert.assertEquals(expected.getAccessTokenLifespan(), actual.getAccessTokenLifespan());
|
||||||
|
|
||||||
Assert.assertEquals(expected.getAccessCodeLifespan(), actual.getAccessCodeLifespan());
|
Assert.assertEquals(expected.getAccessCodeLifespan(), actual.getAccessCodeLifespan());
|
||||||
Assert.assertEquals(expected.getAccessCodeLifespanUserAction(), actual.getAccessCodeLifespanUserAction());
|
Assert.assertEquals(expected.getAccessCodeLifespanUserAction(), actual.getAccessCodeLifespanUserAction());
|
||||||
Assert.assertEquals(expected.getPublicKeyPem(), actual.getPublicKeyPem());
|
Assert.assertEquals(expected.getPublicKeyPem(), actual.getPublicKeyPem());
|
||||||
Assert.assertEquals(expected.getPrivateKeyPem(), actual.getPrivateKeyPem());
|
Assert.assertEquals(expected.getPrivateKeyPem(), actual.getPrivateKeyPem());
|
||||||
|
|
||||||
Assert.assertEquals(expected.getDefaultRoles(), actual.getDefaultRoles());
|
Assert.assertEquals(expected.getDefaultRoles(), actual.getDefaultRoles());
|
||||||
|
|
||||||
Assert.assertEquals(expected.getSmtpConfig(), actual.getSmtpConfig());
|
Assert.assertEquals(expected.getSmtpConfig(), actual.getSmtpConfig());
|
||||||
// FIXME: KEYCLOAK-883
|
// FIXME: KEYCLOAK-883
|
||||||
// Assert.assertEquals(expected.getSocialConfig(), actual.getSocialConfig());
|
// Assert.assertEquals(expected.getSocialConfig(), actual.getSocialConfig());
|
||||||
}
|
}
|
||||||
|
|
||||||
private RealmModel importExport(RealmModel src, String copyName) {
|
private RealmModel importExport(RealmModel src, String copyName) {
|
||||||
RealmRepresentation representation = ModelToRepresentation.toRepresentation(src, true);
|
RealmRepresentation representation = ModelToRepresentation.toRepresentation(src, true);
|
||||||
representation.setRealm(copyName);
|
representation.setRealm(copyName);
|
||||||
representation.setId(copyName);
|
representation.setId(copyName);
|
||||||
RealmModel copy = realmManager.importRealm(representation);
|
RealmModel copy = realmManager.importRealm(representation);
|
||||||
return realmManager.getRealm(copy.getId());
|
return realmManager.getRealm(copy.getId());
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue