Skip to content
Merged
Show file tree
Hide file tree
Changes from 29 commits
Commits
Show all changes
33 commits
Select commit Hold shift + click to select a range
7f2198b
fix: show OAuth 2.0 entities of pages other than "account"
kkedziak-splunk Aug 25, 2025
6f3418b
fix
kkedziak-splunk Aug 26, 2025
b0527cb
fix
kkedziak-splunk Aug 26, 2025
fb5c564
fix
kkedziak-splunk Aug 26, 2025
d31a2b9
fix smoke
kkedziak-splunk Aug 26, 2025
0472058
fix
kkedziak-splunk Aug 26, 2025
4fb2117
fix
kkedziak-splunk Aug 26, 2025
55f2be1
fix
kkedziak-splunk Aug 26, 2025
63509fc
Fix UI test
kkedziak-splunk Aug 26, 2025
e8dc90d
Merge branch 'develop' into fix/oauth_account
kkedziak-splunk Aug 27, 2025
bf5e055
Delete cert
kkedziak-splunk Aug 27, 2025
661b1f3
Merge
kkedziak-splunk Aug 27, 2025
2b4e844
OAuth url fix
kkedziak-splunk Aug 28, 2025
1a396d9
Fix unit tests
kkedziak-splunk Aug 28, 2025
9ea0043
Fix UI warnings
kkedziak-splunk Aug 28, 2025
788ba53
Fix everything test
kkedziak-splunk Aug 28, 2025
0bfdb0d
Fix configuration test
kkedziak-splunk Aug 28, 2025
6241c0e
Fix typing
kkedziak-splunk Aug 28, 2025
315d6e5
Merge branch 'develop' into fix/oauth_url
kkedziak-splunk Aug 28, 2025
687dcc3
Fix test
kkedziak-splunk Aug 28, 2025
8136237
Add logs
kkedziak-splunk Aug 28, 2025
345af28
Add logs
kkedziak-splunk Aug 28, 2025
69d1b9d
Change
kkedziak-splunk Aug 29, 2025
65810e6
Change
kkedziak-splunk Aug 29, 2025
066cb85
Make the server accessible from the container
kkedziak-splunk Aug 29, 2025
0e08635
Run script
kkedziak-splunk Aug 29, 2025
7178505
Merge branch 'develop' into fix/oauth_url
kkedziak-splunk Sep 1, 2025
84d6be1
Fix imports
kkedziak-splunk Sep 1, 2025
d50bceb
Merge branch 'develop' into fix/oauth_url
kkedziak-splunk Sep 2, 2025
b2c6bec
Merge branch 'develop' into fix/oauth_url
kkedziak-splunk Sep 3, 2025
a1915e2
Change the fixture
kkedziak-splunk Sep 3, 2025
dba1b39
Remove use_https
kkedziak-splunk Sep 3, 2025
03ff63c
Merge branch 'develop' into fix/oauth_url
kkedziak-splunk Sep 11, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions .github/workflows/build-test-release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -285,6 +285,16 @@ jobs:
with:
name: test-results-ui-${{ matrix.splunk.version }}-${{ matrix.test-group }}
path: test-results/*
- name: Copy splunkd.log
if: failure()
run: |
docker cp splunk:/opt/splunk/var/log/splunk/splunkd.log ./splunkd.log
- name: Upload splunkd.log to GitHub Check
uses: actions/upload-artifact@v4
if: failure()
with:
name: test-ui-splunkd-splunkd-${{ matrix.splunk.version }}-${{ matrix.test-group }}.log
path: ./splunkd.log
- uses: dorny/test-reporter@v2
if: success() || failure()
with:
Expand Down
1 change: 1 addition & 0 deletions scripts/run_splunk.sh
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ docker run \
-p 8088:8088 \
-p 8089:8089 \
-p 9997:9997 \
--add-host host.docker.internal:host-gateway \
-e "SPLUNK_START_ARGS=--accept-license" \
-e "SPLUNK_PASSWORD=Chang3d!" \
-e "SPLUNK_HEC_TOKEN=4a8a737d-5452-426c-a6f7-106dca4e813f" \
Expand Down
15 changes: 7 additions & 8 deletions splunk_add_on_ucc_framework/templates/oauth.template
Original file line number Diff line number Diff line change
Expand Up @@ -3,18 +3,16 @@ This module will be used to get oauth token from auth code
"""
import import_declare_test

import urllib
try:
from urllib import urlencode
except:
from urllib.parse import urlencode
import json
from httplib2 import Http, ProxyInfo, socks
import splunk.admin as admin
from urllib.parse import urlencode, urlsplit

from solnlib import log
from solnlib import conf_manager
from solnlib.conf_manager import InvalidHostnameError, InvalidPortError
from solnlib.utils import is_true
import json
import splunk.admin as admin
from splunk.rest import getcontext


log.Logs.set_context()
Expand Down Expand Up @@ -85,7 +83,8 @@ class {{app_name | lower}}_rh_oauth2_token(admin.MConfigHandler):
logger.debug("oAUth url %s", url)
proxy_info = self.getProxyDetails()

http = Http(proxy_info=proxy_info)
context = getcontext(urlsplit(url))
http = Http(proxy_info=proxy_info, context=context)
method = self.callerArgs.data['method'][0]

# Create payload from the arguments received
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,18 +3,16 @@
"""
import import_declare_test

import urllib
try:
from urllib import urlencode
except:
from urllib.parse import urlencode
import json
from httplib2 import Http, ProxyInfo, socks
import splunk.admin as admin
from urllib.parse import urlencode, urlsplit

from solnlib import log
from solnlib import conf_manager
from solnlib.conf_manager import InvalidHostnameError, InvalidPortError
from solnlib.utils import is_true
import json
import splunk.admin as admin
from splunk.rest import getcontext


log.Logs.set_context()
Expand Down Expand Up @@ -85,7 +83,8 @@ def handleEdit(self, confInfo):
logger.debug("oAUth url %s", url)
proxy_info = self.getProxyDetails()

http = Http(proxy_info=proxy_info)
context = getcontext(urlsplit(url))
http = Http(proxy_info=proxy_info, context=context)
method = self.callerArgs.data['method'][0]

# Create payload from the arguments received
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,18 +3,16 @@
"""
import import_declare_test

import urllib
try:
from urllib import urlencode
except:
from urllib.parse import urlencode
import json
from httplib2 import Http, ProxyInfo, socks
import splunk.admin as admin
from urllib.parse import urlencode, urlsplit

from solnlib import log
from solnlib import conf_manager
from solnlib.conf_manager import InvalidHostnameError, InvalidPortError
from solnlib.utils import is_true
import json
import splunk.admin as admin
from splunk.rest import getcontext


log.Logs.set_context()
Expand Down Expand Up @@ -85,7 +83,8 @@ def handleEdit(self, confInfo):
logger.debug("oAUth url %s", url)
proxy_info = self.getProxyDetails()

http = Http(proxy_info=proxy_info)
context = getcontext(urlsplit(url))
http = Http(proxy_info=proxy_info, context=context)
method = self.callerArgs.data['method'][0]

# Create payload from the arguments received
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,14 @@
encrypted=False,
default=None,
validator=None
),
),
field.RestField(
'endpoint',
required=False,
encrypted=False,
default=None,
validator=None
),
field.RestField(
'access_token',
required=False,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -748,10 +748,16 @@
"label": "Redirect url",
"field": "redirect_url",
"help": "Copy and paste this URL into your app."
},
{
"oauth_field": "endpoint",
"label": "Endpoint",
"field": "endpoint",
"help": "Put here endpoint, ie. login.salesforce.com"
}
],
"auth_code_endpoint": "/services/oauth2/authorize",
"access_token_endpoint": "/services/oauth2/token",
"auth_code_endpoint": "/oauth/authorize",
"access_token_endpoint": "/oauth/token",
"oauth_timeout": 30,
"oauth_state_enabled": false
}
Expand Down
10 changes: 10 additions & 0 deletions tests/ui/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

import pytest

from tests.ui.oauth2_server.oauth_server import OAuth2TestServer
from tests.ui.pages.account_page import AccountPage
from tests.ui.test_configuration_page_account_tab import _ACCOUNT_CONFIG
from pytest_splunk_addon_ui_smartx import utils as s_utils
Expand Down Expand Up @@ -53,3 +54,12 @@ def pytest_runtest_call(item: pytest.Item) -> Iterator[Any]:
log_msg = [f"{log.level}: {log.source} - {log.message}" for log in severe_logs]
msg = "Severe logs found in browser console logs: \n" + "\n".join(log_msg)
pytest.fail(msg, pytrace=True)


@pytest.fixture
def oauth_server_port():
"""Pytest fixture for OAuth2 test server."""
server = OAuth2TestServer(use_https=True, host="0.0.0.0") # Use random port
server.start()
yield server.port
server.stop()
Empty file.
46 changes: 46 additions & 0 deletions tests/ui/oauth2_server/login_form.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
<!DOCTYPE html>
<html>
<head>
<title>OAuth2 Test Server - Login</title>
<style>
body { font-family: Arial, sans-serif; margin: 50px; }
.form-container { max-width: 400px; margin: 0 auto; }
.form-group { margin: 15px 0; }
label { display: block; margin-bottom: 5px; }
input { width: 100%; padding: 8px; box-sizing: border-box; }
button { background-color: #007cba; color: white; padding: 10px 20px; border: none; cursor: pointer; }
button:hover { background-color: #005a87; }
.info { background-color: #f0f0f0; padding: 15px; margin-bottom: 20px; border-radius: 5px; }
</style>
</head>
<body>
<div class="form-container">
<h2>OAuth2 Test Server</h2>
<div class="info">
<strong>Test Credentials:</strong><br>
Email: Any email address<br>
Password: <code>good</code>
</div>
<form method="post" action="/oauth/authorize">
<input type="hidden" name="client_id" value="${client_id}">
<input type="hidden" name="redirect_uri" value="${redirect_uri}">
<input type="hidden" name="state" value="${state}">
<input type="hidden" name="response_type" value="${response_type}">

<div class="form-group">
<label for="email">Email:</label>
<input type="email" id="email" name="email" required>
</div>

<div class="form-group">
<label for="password">Password:</label>
<input type="password" id="password" name="password" required>
</div>

<div class="form-group">
<button type="submit">Login</button>
</div>
</form>
</div>
</body>
</html>
Loading
Loading