editorconfig: max line length set
max line length warnings removed missing Copyright added useless publics removed unmaintainable Javadoc tags: @author removed helper class warnings removed field default value initialization removed Multiple warnings removed pref: checkstyle warnings removed Checkstyle will fail the build process if it detects violations switch default cases error logger added
This commit is contained in:
@@ -24,10 +24,8 @@ import java.text.ParseException;
|
||||
/**
|
||||
* Parses the acl configuration file. If a line starts with # it's comment. Blank lines are skipped.
|
||||
* The format is "topic [read|write|readwrite] {topic name}"
|
||||
*
|
||||
* @author andrea
|
||||
*/
|
||||
public class ACLFileParser {
|
||||
public final class ACLFileParser {
|
||||
|
||||
private static final Logger LOG = LoggerFactory.getLogger(ACLFileParser.class);
|
||||
|
||||
@@ -110,4 +108,7 @@ public class ACLFileParser {
|
||||
}
|
||||
return collector;
|
||||
}
|
||||
|
||||
private ACLFileParser() {
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,11 +1,23 @@
|
||||
/*
|
||||
* Copyright (c) 2012-2017 The original author or authors
|
||||
* ------------------------------------------------------
|
||||
* All rights reserved. This program and the accompanying materials
|
||||
* are made available under the terms of the Eclipse Public License v1.0
|
||||
* and Apache License v2.0 which accompanies this distribution.
|
||||
*
|
||||
* The Eclipse Public License is available at
|
||||
* http://www.eclipse.org/legal/epl-v10.html
|
||||
*
|
||||
* The Apache License v2.0 is available at
|
||||
* http://www.opensource.org/licenses/apache2.0.php
|
||||
*
|
||||
* You may elect to redistribute this code under either of these licenses.
|
||||
*/
|
||||
|
||||
package io.moquette.spi.impl.security;
|
||||
|
||||
import io.moquette.spi.security.IAuthenticator;
|
||||
|
||||
/**
|
||||
* Created by andrea on 8/23/14.
|
||||
*/
|
||||
public class AcceptAllAuthenticator implements IAuthenticator {
|
||||
|
||||
public boolean checkValid(String clientId, String username, byte[] password) {
|
||||
|
||||
@@ -21,8 +21,6 @@ import io.moquette.spi.impl.subscriptions.Topic;
|
||||
|
||||
/**
|
||||
* Carries the read/write authorization to topics for the users.
|
||||
*
|
||||
* @author andrea
|
||||
*/
|
||||
public class Authorization {
|
||||
|
||||
|
||||
@@ -18,8 +18,6 @@ package io.moquette.spi.impl.security;
|
||||
|
||||
import io.moquette.spi.impl.subscriptions.Topic;
|
||||
import io.moquette.spi.security.IAuthorizator;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import java.text.ParseException;
|
||||
import java.util.*;
|
||||
|
||||
@@ -28,18 +26,14 @@ import java.util.*;
|
||||
* mode to check it topics matches the ACLs.
|
||||
*
|
||||
* Not thread safe.
|
||||
*
|
||||
* @author andrea
|
||||
*/
|
||||
class AuthorizationsCollector implements IAuthorizator {
|
||||
|
||||
private static final Logger LOG = LoggerFactory.getLogger(AuthorizationsCollector.class);
|
||||
|
||||
private List<Authorization> m_globalAuthorizations = new ArrayList<>();
|
||||
private List<Authorization> m_patternAuthorizations = new ArrayList<>();
|
||||
private Map<String, List<Authorization>> m_userAuthorizations = new HashMap<>();
|
||||
private boolean m_parsingUsersSpecificSection = false;
|
||||
private boolean m_parsingPatternSpecificSection = false;
|
||||
private boolean m_parsingUsersSpecificSection;
|
||||
private boolean m_parsingPatternSpecificSection;
|
||||
private String m_currentUser = "";
|
||||
|
||||
static final AuthorizationsCollector emptyImmutableCollector() {
|
||||
|
||||
@@ -1,3 +1,18 @@
|
||||
/*
|
||||
* Copyright (c) 2012-2017 The original author or authors
|
||||
* ------------------------------------------------------
|
||||
* All rights reserved. This program and the accompanying materials
|
||||
* are made available under the terms of the Eclipse Public License v1.0
|
||||
* and Apache License v2.0 which accompanies this distribution.
|
||||
*
|
||||
* The Eclipse Public License is available at
|
||||
* http://www.eclipse.org/legal/epl-v10.html
|
||||
*
|
||||
* The Apache License v2.0 is available at
|
||||
* http://www.opensource.org/licenses/apache2.0.php
|
||||
*
|
||||
* You may elect to redistribute this code under either of these licenses.
|
||||
*/
|
||||
|
||||
package io.moquette.spi.impl.security;
|
||||
|
||||
@@ -13,10 +28,7 @@ import java.sql.*;
|
||||
|
||||
/**
|
||||
* Load user credentials from a SQL database. sql driver must be provided at runtime
|
||||
*
|
||||
* @author mackristof
|
||||
*/
|
||||
|
||||
public class DBAuthenticator implements IAuthenticator {
|
||||
|
||||
private static final Logger LOG = LoggerFactory.getLogger(DBAuthenticator.class);
|
||||
|
||||
@@ -19,9 +19,6 @@ package io.moquette.spi.impl.security;
|
||||
import io.moquette.spi.impl.subscriptions.Topic;
|
||||
import io.moquette.spi.security.IAuthorizator;
|
||||
|
||||
/**
|
||||
* @author andrea
|
||||
*/
|
||||
public class DenyAllAuthorizator implements IAuthorizator {
|
||||
|
||||
@Override
|
||||
|
||||
@@ -31,7 +31,6 @@ import io.moquette.server.config.FileResourceLoader;
|
||||
* NB -n is important because echo append a newline by default at the of string. -n avoid this
|
||||
* behaviour.
|
||||
*
|
||||
* @author andrea
|
||||
* @deprecated user {@link ResourceAuthenticator} instead
|
||||
*/
|
||||
public class FileAuthenticator extends ResourceAuthenticator {
|
||||
|
||||
@@ -19,9 +19,6 @@ package io.moquette.spi.impl.security;
|
||||
import io.moquette.spi.impl.subscriptions.Topic;
|
||||
import io.moquette.spi.security.IAuthorizator;
|
||||
|
||||
/**
|
||||
* @author andrea
|
||||
*/
|
||||
public class PermitAllAuthorizator implements IAuthorizator {
|
||||
|
||||
@Override
|
||||
|
||||
@@ -42,19 +42,16 @@ import java.util.Map;
|
||||
*
|
||||
* NB -n is important because echo append a newline by default at the of string. -n avoid this
|
||||
* behaviour.
|
||||
*
|
||||
* @author andrea
|
||||
*/
|
||||
public class ResourceAuthenticator implements IAuthenticator {
|
||||
|
||||
protected static final Logger LOG = LoggerFactory.getLogger(ResourceAuthenticator.class);
|
||||
|
||||
private Map<String, String> m_identities = new HashMap<>();
|
||||
private MessageDigest m_digest;
|
||||
|
||||
public ResourceAuthenticator(IResourceLoader resourceLoader, String resourceName) {
|
||||
try {
|
||||
this.m_digest = MessageDigest.getInstance("SHA-256");
|
||||
MessageDigest.getInstance("SHA-256");
|
||||
} catch (NoSuchAlgorithmException nsaex) {
|
||||
LOG.error("Can't find SHA-256 for password encoding", nsaex);
|
||||
throw new RuntimeException(nsaex);
|
||||
|
||||
Reference in New Issue
Block a user