Skip to content

Commit

Permalink
commit inicial
Browse files Browse the repository at this point in the history
  • Loading branch information
matheusdaluz committed Oct 17, 2018
0 parents commit cd9d688
Show file tree
Hide file tree
Showing 235 changed files with 568 additions and 0 deletions.
Binary file added .DS_Store
Binary file not shown.
16 changes: 16 additions & 0 deletions .gitignore
@@ -0,0 +1,16 @@
.idea/
*.iml
*.ipr
*.iws
.classpath
.project
.settings/
target/
dependency-reduced-pom.xml
node_modules
node
build
build.config.js.sample
cache
cache/

45 changes: 45 additions & 0 deletions README.md
@@ -0,0 +1,45 @@
# GloboAuth Plugin for Graylog


__Use this paragraph to enter a description of your plugin.__

**Required Graylog version:** 2.3 and later

Installation
------------

[Download the plugin](https://github.com/none/releases)
and place the `.jar` file in your Graylog plugin directory. The plugin directory
is the `plugins/` folder relative from your `graylog-server` directory by default
and can be configured in your `graylog.conf` file.

Restart `graylog-server` and you are done.

Development
-----------

You can improve your development experience for the web interface part of your plugin
dramatically by making use of hot reloading. To do this, do the following:

* `git clone https://github.com/Graylog2/graylog2-server.git`
* `cd graylog2-server/graylog2-web-interface`
* `ln -s $YOURPLUGIN plugin/`
* `npm install && npm start`

Usage
-----

__Use this paragraph to document the usage of your plugin__


Getting started
---------------

This project is using Maven 3 and requires Java 8 or higher.

* Clone this repository.
* Run `mvn package` to build a JAR file.
* Optional: Run `mvn jdeb:jdeb` and `mvn rpm:rpm` to create a DEB and RPM package respectively.
* Copy generated JAR file in target directory to your Graylog plugin directory.
* Restart the Graylog.

6 changes: 6 additions & 0 deletions build.config.js
@@ -0,0 +1,6 @@
const path = require('path');

module.exports = {
// Make sure that this is the correct path to the web interface part of the Graylog server repository.
web_src_path: path.resolve(__dirname, '../graylog2-server/graylog2-web-interface'),
};
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file added cache/bb9ec08fdcc294e1ed6731fd3a33ff580372eb1a.json.gz
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file added cache/d91b5b141c2cabc8dad4a4e1746f6e8c37759eb3.json.gz
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file added cache/e2830450e6f28e8a2d05556afc35ac5061b02164.json.gz
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
21 changes: 21 additions & 0 deletions package.json
@@ -0,0 +1,21 @@
{
"name": "GloboAuth",
"version": "1.0.0-SNAPSHOT",
"description": "Globo Auth",
"repository": {
"type": "git",
"url": ""
},
"scripts": {
"build": "webpack --bail"
},
"keywords": [
"graylog"
],
"author": "Matheus Da Luz Costa <matheus.costa@corp.globo.com>",
"license": "MIT",
"dependencies": {},
"devDependencies": {
"graylog-web-plugin": "file:../graylog2-server/graylog2-web-interface/packages/graylog-web-plugin"
}
}
125 changes: 125 additions & 0 deletions pom.xml
@@ -0,0 +1,125 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>org.graylog.plugins</groupId>
<artifactId>graylog-plugin-web-parent</artifactId>
<version>2.3.0</version>
<relativePath>../graylog2-server/graylog-plugin-parent/graylog-plugin-web-parent</relativePath>
</parent>
<groupId>com.globo</groupId>
<artifactId>graylog-plugin-globo-auth</artifactId>
<version>1.0.0-SNAPSHOT</version>
<packaging>jar</packaging>

<name>${project.artifactId}</name>
<description>Graylog ${project.artifactId} plugin.</description>
<url>https://www.graylog.org</url>

<developers>
<developer>
<name>Matheus Da Luz Costa</name>
<email>matheus.costa@corp.globo.com</email>
</developer>
</developers>

<scm>
<connection>scm:git:git@github.com:none.git</connection>
<developerConnection>scm:git:git@github.com:none.git</developerConnection>
<url>https://github.com/none</url>
<tag>HEAD</tag>
</scm>

<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<maven.compiler.source>1.8</maven.compiler.source>
<maven.compiler.target>1.8</maven.compiler.target>

<!-- Skip unnecessary build steps -->
<maven.source.skip>true</maven.source.skip>
<maven.javadoc.skip>true</maven.javadoc.skip>
<maven.install.skip>true</maven.install.skip>
<maven.deploy.skip>true</maven.deploy.skip>
<maven.site.skip>true</maven.site.skip>

<graylog.version>2.3.0</graylog.version>
</properties>

<dependencies>
<dependency>
<groupId>org.graylog2</groupId>
<artifactId>graylog2-server</artifactId>
<version>${graylog.version}</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>com.google.auto.value</groupId>
<artifactId>auto-value</artifactId>
<version>${auto-value.version}</version>
<scope>provided</scope>
</dependency>
</dependencies>

<build>
<resources>
<resource><directory>build</directory></resource>
<resource>
<directory>src/main/resources</directory>
<filtering>true</filtering>
</resource>
</resources>
<plugins>
<plugin>
<artifactId>maven-assembly-plugin</artifactId>
<configuration>
<skipAssembly>true</skipAssembly>
</configuration>
</plugin>

<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-jar-plugin</artifactId>
<configuration>
<archive>
<manifestEntries>
<Graylog-Plugin-Properties-Path>${project.groupId}.${project.artifactId}</Graylog-Plugin-Properties-Path>
</manifestEntries>
</archive>
</configuration>
</plugin>

<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-shade-plugin</artifactId>
<configuration>
<minimizeJar>false</minimizeJar>
</configuration>
<executions>
<execution>
<phase>package</phase>
<goals>
<goal>shade</goal>
</goals>
<configuration>
<transformers>
<transformer implementation="org.apache.maven.plugins.shade.resource.ServicesResourceTransformer"/>
</transformers>
</configuration>
</execution>
</executions>
</plugin>

<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-release-plugin</artifactId>
<configuration>
<autoVersionSubmodules>true</autoVersionSubmodules>
<mavenExecutorId>forked-path</mavenExecutorId>
<tagNameFormat>@{project.version}</tagNameFormat>
<preparationGoals>clean test</preparationGoals>
<goals>package</goals>
</configuration>
</plugin>
</plugins>
</build>
</project>
8 changes: 8 additions & 0 deletions src/deb/control/control
@@ -0,0 +1,8 @@
Package: [[name]]
Version: [[version]]
Architecture: all
Maintainer: Matheus Da Luz Costa <matheus.costa@corp.globo.com>
Section: web
Priority: optional
Depends: graylog-server | graylog-radio
Description: [[description]]
37 changes: 37 additions & 0 deletions src/main/java/com/globo/GloboAuthAuditEventTypes.java
@@ -0,0 +1,37 @@
/**
* This file is part of Graylog Archive.
*
* Graylog Archive is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* Graylog Archive is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with Graylog Archive. If not, see <http://www.gnu.org/licenses/>.
*/
package com.globo;

import com.google.common.collect.ImmutableSet;
import org.graylog2.audit.PluginAuditEventTypes;

import java.util.Set;

public class GloboAuthAuditEventTypes implements PluginAuditEventTypes {
private static final String NAMESPACE = "globoauth:";

public static final String CONFIG_UPDATE = NAMESPACE + "config:update";

private static final Set<String> EVENT_TYPES = ImmutableSet.<String>builder()
.add(CONFIG_UPDATE)
.build();

@Override
public Set<String> auditEventTypes() {
return EVENT_TYPES;
}
}
68 changes: 68 additions & 0 deletions src/main/java/com/globo/GloboAuthConfig.java
@@ -0,0 +1,68 @@
package com.globo;


import com.fasterxml.jackson.annotation.JsonAutoDetect;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
import com.google.auto.value.AutoValue;

import javax.annotation.Nullable;

@AutoValue
@JsonDeserialize(builder = AutoValue_GloboAuthConfig.Builder.class)
@JsonAutoDetect
public abstract class GloboAuthConfig {

public static Builder builder() {
return new AutoValue_GloboAuthConfig.Builder();
}

public abstract Builder toBuilder();

public static GloboAuthConfig defaultConfig() {
return builder()
.usernameHeader("Remote-User")
.autoCreateUser(true)
.build();
}

@JsonProperty("username_header")
public abstract String usernameHeader();

@JsonProperty("fullname_header")
@Nullable
public abstract String fullnameHeader();

@JsonProperty("email_header")
@Nullable
public abstract String emailHeader();

@JsonProperty("default_group")
@Nullable
public abstract String defaultGroup();

@JsonProperty("auto_create_user")
public abstract boolean autoCreateUser();


@AutoValue.Builder
public static abstract class Builder {
abstract GloboAuthConfig build();

@JsonProperty("username_header")
public abstract Builder usernameHeader(String usernameHeader);

@JsonProperty("fullname_header")
public abstract Builder fullnameHeader(@Nullable String fullnameHeader);

@JsonProperty("email_header")
public abstract Builder emailHeader(@Nullable String emailHeader);

@JsonProperty("default_group")
public abstract Builder defaultGroup(@Nullable String defaultGroup);

@JsonProperty("auto_create_user")
public abstract Builder autoCreateUser(boolean autoCreateUser);

}
}
57 changes: 57 additions & 0 deletions src/main/java/com/globo/GloboAuthMetaData.java
@@ -0,0 +1,57 @@
package com.globo;

import org.graylog2.plugin.PluginMetaData;
import org.graylog2.plugin.ServerStatus;
import org.graylog2.plugin.Version;

import java.net.URI;
import java.util.Collections;
import java.util.Set;

/**
* Implement the PluginMetaData interface here.
*/
public class GloboAuthMetaData implements PluginMetaData {
private static final String PLUGIN_PROPERTIES = "com.globo.graylog-plugin-globo-auth/graylog-plugin.properties";

@Override
public String getUniqueId() {
return "com.globo.GloboAuthPlugin";
}

@Override
public String getName() {
return "GloboAuth";
}

@Override
public String getAuthor() {
return "Matheus Da Luz Costa <matheus.costa@corp.globo.com>";
}

@Override
public URI getURL() {
return URI.create("https://github.com/none");
}

@Override
public Version getVersion() {
return Version.fromPluginProperties(getClass(), PLUGIN_PROPERTIES, "version", Version.from(0, 0, 0, "unknown"));
}

@Override
public String getDescription() {
// TODO Insert correct plugin description
return "Description of GloboAuth plugin";
}

@Override
public Version getRequiredVersion() {
return Version.fromPluginProperties(getClass(), PLUGIN_PROPERTIES, "graylog.version", Version.from(0, 0, 0, "unknown"));
}

@Override
public Set<ServerStatus.Capability> getRequiredCapabilities() {
return Collections.emptySet();
}
}

0 comments on commit cd9d688

Please sign in to comment.