Commit 087ddec9 authored by Gaston Dombiak's avatar Gaston Dombiak Committed by gato

Allowed to specify wildcards for external component configurations. JM-1367

git-svn-id: http://svn.igniterealtime.org/svn/repos/openfire/trunk@10410 b35dd754-fafc-0310-a699-88a17e54d16e
parent f8d0551c
......@@ -134,6 +134,7 @@ CREATE TABLE ofVersion (
CREATE TABLE ofExtComponentConf (
subdomain VARCHAR(255) NOT NULL,
wildcard INTEGER NOT NULL,
secret VARCHAR(255),
permission VARCHAR(10) NOT NULL,
CONSTRAINT ofExtComponentConf_pk PRIMARY KEY (subdomain)
......@@ -385,7 +386,7 @@ INSERT INTO ofID (idType, id) VALUES (19, 1);
INSERT INTO ofID (idType, id) VALUES (23, 1);
INSERT INTO ofID (idType, id) VALUES (26, 1);
INSERT INTO ofVersion (name, version) VALUES ('openfire', 19);
INSERT INTO ofVersion (name, version) VALUES ('openfire', 20);
-- Entry for admin user
INSERT INTO ofUser (username, plainPassword, name, email, creationDate, modificationDate)
......
......@@ -133,6 +133,7 @@ CREATE TABLE ofVersion (
CREATE TABLE ofExtComponentConf (
subdomain VARCHAR(255) NOT NULL,
wildcard INTEGER NOT NULL,
secret VARCHAR(255),
permission VARCHAR(10) NOT NULL,
CONSTRAINT ofExtComponentConf_pk PRIMARY KEY (subdomain)
......@@ -371,7 +372,7 @@ INSERT INTO ofID (idType, id) VALUES (19, 1);
INSERT INTO ofID (idType, id) VALUES (23, 1);
INSERT INTO ofID (idType, id) VALUES (26, 1);
INSERT INTO ofVersion (name, version) VALUES ('openfire', 19);
INSERT INTO ofVersion (name, version) VALUES ('openfire', 20);
// Entry for admin user
INSERT INTO ofUser (username, plainPassword, name, email, creationDate, modificationDate)
......
......@@ -122,6 +122,7 @@ CREATE TABLE ofVersion (
CREATE TABLE ofExtComponentConf (
subdomain VARCHAR(255) NOT NULL,
wildcard TINYINT NOT NULL,
secret VARCHAR(255),
permission VARCHAR(10) NOT NULL,
PRIMARY KEY (subdomain)
......@@ -360,7 +361,7 @@ INSERT INTO ofID (idType, id) VALUES (19, 1);
INSERT INTO ofID (idType, id) VALUES (23, 1);
INSERT INTO ofID (idType, id) VALUES (26, 1);
INSERT INTO ofVersion (name, version) VALUES ('openfire', 19);
INSERT INTO ofVersion (name, version) VALUES ('openfire', 20);
# Entry for admin user
INSERT INTO ofUser (username, plainPassword, name, email, creationDate, modificationDate)
......
......@@ -130,6 +130,7 @@ CREATE TABLE ofVersion (
CREATE TABLE ofExtComponentConf (
subdomain VARCHAR2(255) NOT NULL,
wildcard INTEGER NOT NULL,
secret VARCHAR2(255),
permission VARCHAR2(10) NOT NULL,
CONSTRAINT ofExtComponentConf_pk PRIMARY KEY (subdomain)
......@@ -368,7 +369,7 @@ INSERT INTO ofID (idType, id) VALUES (19, 1);
INSERT INTO ofID (idType, id) VALUES (23, 1);
INSERT INTO ofID (idType, id) VALUES (26, 1);
INSERT INTO ofVersion (name, version) VALUES ('openfire', 19);
INSERT INTO ofVersion (name, version) VALUES ('openfire', 20);
-- Entry for admin user
INSERT INTO ofUser (username, plainPassword, name, email, creationDate, modificationDate)
......
......@@ -138,6 +138,7 @@ CREATE TABLE ofVersion (
CREATE TABLE ofExtComponentConf (
subdomain VARCHAR(255) NOT NULL,
wildcard INTEGER NOT NULL,
secret VARCHAR(255),
permission VARCHAR(10) NOT NULL,
CONSTRAINT ofExtComponentConf_pk PRIMARY KEY (subdomain)
......@@ -376,7 +377,7 @@ INSERT INTO ofID (idType, id) VALUES (19, 1);
INSERT INTO ofID (idType, id) VALUES (23, 1);
INSERT INTO ofID (idType, id) VALUES (26, 1);
INSERT INTO ofVersion (name, version) VALUES ('openfire', 19);
INSERT INTO ofVersion (name, version) VALUES ('openfire', 20);
-- Entry for admin user
INSERT INTO ofUser (username, plainPassword, name, email, creationDate, modificationDate)
......
......@@ -136,6 +136,7 @@ CREATE TABLE ofVersion (
CREATE TABLE ofExtComponentConf (
subdomain NVARCHAR(255) NOT NULL,
wildcard INT NOT NULL,
secret NVARCHAR(255),
permission NVARCHAR(10) NOT NULL,
CONSTRAINT ofExtComponentConf_pk PRIMARY KEY (subdomain)
......@@ -374,7 +375,7 @@ INSERT INTO ofID (idType, id) VALUES (19, 1);
INSERT INTO ofID (idType, id) VALUES (23, 1);
INSERT INTO ofID (idType, id) VALUES (26, 1);
INSERT INTO ofVersion (name, version) VALUES ('openfire', 19);
INSERT INTO ofVersion (name, version) VALUES ('openfire', 20);
/* Entry for admin user */
INSERT INTO ofUser (username, plainPassword, name, email, creationDate, modificationDate)
......
......@@ -136,6 +136,7 @@ CREATE TABLE ofVersion (
CREATE TABLE ofExtComponentConf (
subdomain NVARCHAR(255) NOT NULL,
wildcard INT NOT NULL,
secret NVARCHAR(255) NULL,
permission NVARCHAR(10) NOT NULL,
CONSTRAINT ofExtComponentConf_pk PRIMARY KEY (subdomain)
......@@ -374,7 +375,7 @@ INSERT INTO ofID (idType, id) VALUES (19, 1);
INSERT INTO ofID (idType, id) VALUES (23, 1);
INSERT INTO ofID (idType, id) VALUES (26, 1);
INSERT INTO ofVersion (name, version) VALUES ('openfire', 19);
INSERT INTO ofVersion (name, version) VALUES ('openfire', 20);
/* Entry for admin user */
INSERT INTO ofUser (username, plainPassword, name, email, creationDate, modificationDate)
......
-- add wildcard column to ofExtComponentConf
ALTER TABLE ofExtComponentConf ADD COLUMN wildcard INTEGER DEFAULT 0 NOT NULL;
-- Update version
UPDATE ofVersion SET version = 20 WHERE name = 'openfire';
\ No newline at end of file
// add wildcard column to ofExtComponentConf
ALTER TABLE ofExtComponentConf ADD COLUMN wildcard INTEGER DEFAULT 0 NOT NULL;
// Update version
UPDATE ofVersion SET version = 20 WHERE name = 'openfire';
\ No newline at end of file
# add wildcard column to ofExtComponentConf
ALTER TABLE ofExtComponentConf ADD COLUMN wildcard TINYINT NOT NULL DEFAULT 0;
# Update version
UPDATE ofVersion SET version = 20 WHERE name = 'openfire';
-- add wildcard column to ofExtComponentConf
ALTER TABLE ofExtComponentConf ADD wildcard INTEGER DEFAULT 0 NOT NULL;
-- Update version
UPDATE ofVersion SET version = 20 WHERE name = 'openfire';
COMMIT;
\ No newline at end of file
-- add wildcard column to ofExtComponentConf
ALTER TABLE ofExtComponentConf ADD COLUMN wildcard INTEGER DEFAULT 0 NOT NULL;
-- Update version
UPDATE ofVersion SET version = 20 WHERE name = 'openfire';
/* add wildcard column to ofExtComponentConf */
ALTER TABLE ofExtComponentConf ADD wildcard INT DEFAULT 0 NOT NULL;
/* Update version */
UPDATE ofVersion SET version = 20 WHERE name = 'openfire';
/* add wildcard column to ofExtComponentConf */
ALTER TABLE ofExtComponentConf ADD COLUMN wildcard INT DEFAULT 0 NOT NULL;
/* Update version */
UPDATE ofVersion SET version = 20 WHERE name = 'openfire';
......@@ -47,7 +47,7 @@ public class SchemaManager {
/**
* Current Openfire database schema version.
*/
private static final int DATABASE_VERSION = 19;
private static final int DATABASE_VERSION = 20;
/**
* Creates a new Schema manager.
......
......@@ -424,7 +424,7 @@ public class ClearspaceManager extends BasicModule implements ExternalComponentM
*/
public void setSharedSecret(String sharedSecret) {
// Set new password for external component
ExternalComponentConfiguration configuration = new ExternalComponentConfiguration("clearspace",
ExternalComponentConfiguration configuration = new ExternalComponentConfiguration("clearspace", true,
ExternalComponentConfiguration.Permission.allowed, sharedSecret);
try {
ExternalComponentManager.allowAccess(configuration);
......
......@@ -11,13 +11,19 @@ package org.jivesoftware.openfire.component;
public class ExternalComponentConfiguration {
private String subdomain;
/**
* Flag that indicates if components whose domain starts with the subdomain of this configuration
* should use this configuration.
*/
private boolean wildcard;
private Permission permission;
private String secret;
public ExternalComponentConfiguration(String subdomain, Permission permission, String secret) {
public ExternalComponentConfiguration(String subdomain, boolean wildcard, Permission permission, String secret) {
this.subdomain = subdomain;
this.wildcard = wildcard;
this.permission = permission;
this.secret = secret;
}
......@@ -26,6 +32,10 @@ public class ExternalComponentConfiguration {
return subdomain;
}
public boolean isWildcard() {
return wildcard;
}
public Permission getPermission() {
return permission;
}
......
......@@ -130,7 +130,7 @@
if (errors.isEmpty()) {
// Remove the hostname if the user is not sending just the subdomain
subdomain = subdomain.replace("." + serverName, "");
ExternalComponentConfiguration configuration = new ExternalComponentConfiguration(subdomain,
ExternalComponentConfiguration configuration = new ExternalComponentConfiguration(subdomain, false,
ExternalComponentConfiguration.Permission.allowed, secret);
try {
ExternalComponentManager.allowAccess(configuration);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment