forked from p15670423/monkey
Merge pull request #2168 from guardicore/2109-auth-island-version
2109 auth island version
This commit is contained in:
commit
212d638af1
|
@ -19,6 +19,7 @@ Changelog](https://keepachangelog.com/en/1.0.0/).
|
||||||
- `/api/reset-agent-configuration` endpoint. #2036
|
- `/api/reset-agent-configuration` endpoint. #2036
|
||||||
- `/api/clear-simulation-data` endpoint. #2036
|
- `/api/clear-simulation-data` endpoint. #2036
|
||||||
- `/api/registration-status` endpoint. #2149
|
- `/api/registration-status` endpoint. #2149
|
||||||
|
- authentication to `/api/island/version`. #2109
|
||||||
|
|
||||||
### Changed
|
### Changed
|
||||||
- Reset workflow. Now it's possible to delete data gathered by agents without
|
- Reset workflow. Now it's possible to delete data gathered by agents without
|
||||||
|
|
|
@ -2,6 +2,7 @@ import logging
|
||||||
|
|
||||||
from monkey_island.cc import Version
|
from monkey_island.cc import Version
|
||||||
from monkey_island.cc.resources.AbstractResource import AbstractResource
|
from monkey_island.cc.resources.AbstractResource import AbstractResource
|
||||||
|
from monkey_island.cc.resources.request_authentication import jwt_required
|
||||||
|
|
||||||
logger = logging.getLogger(__name__)
|
logger = logging.getLogger(__name__)
|
||||||
|
|
||||||
|
@ -12,8 +13,7 @@ class Version(AbstractResource):
|
||||||
def __init__(self, version: Version):
|
def __init__(self, version: Version):
|
||||||
self._version = version
|
self._version = version
|
||||||
|
|
||||||
# We don't secure this since it doesn't give out any private info and we want UI to know version
|
@jwt_required
|
||||||
# even when not authenticated
|
|
||||||
def get(self):
|
def get(self):
|
||||||
return {
|
return {
|
||||||
"version_number": self._version.version_number,
|
"version_number": self._version.version_number,
|
||||||
|
|
|
@ -2,8 +2,9 @@ import React from 'react';
|
||||||
|
|
||||||
import { FontAwesomeIcon } from '@fortawesome/react-fontawesome';
|
import { FontAwesomeIcon } from '@fortawesome/react-fontawesome';
|
||||||
import { faDownload } from '@fortawesome/free-solid-svg-icons/faDownload';
|
import { faDownload } from '@fortawesome/free-solid-svg-icons/faDownload';
|
||||||
|
import AuthComponent from '../AuthComponent';
|
||||||
|
|
||||||
class VersionComponent extends React.Component {
|
class VersionComponent extends AuthComponent {
|
||||||
constructor(props) {
|
constructor(props) {
|
||||||
super(props);
|
super(props);
|
||||||
this.state = {
|
this.state = {
|
||||||
|
@ -14,7 +15,7 @@ class VersionComponent extends React.Component {
|
||||||
}
|
}
|
||||||
|
|
||||||
componentDidMount() {
|
componentDidMount() {
|
||||||
fetch('/api/island/version') // This is not authenticated on purpose
|
this.authFetch('/api/island/version')
|
||||||
.then(res => res.json())
|
.then(res => res.json())
|
||||||
.then(res => {
|
.then(res => {
|
||||||
this.setState({
|
this.setState({
|
||||||
|
|
Loading…
Reference in New Issue