toolframe-dashboard-auth 0.1.3__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- toolframe_dashboard_auth/__init__.py +1 -0
- toolframe_dashboard_auth/connections.py +40 -0
- toolframe_dashboard_auth/login.html +24 -0
- toolframe_dashboard_auth/mcp_page.py +146 -0
- toolframe_dashboard_auth/page.py +338 -0
- toolframe_dashboard_auth/plugin.py +69 -0
- toolframe_dashboard_auth/users.py +52 -0
- toolframe_dashboard_auth-0.1.3.dist-info/METADATA +106 -0
- toolframe_dashboard_auth-0.1.3.dist-info/RECORD +13 -0
- toolframe_dashboard_auth-0.1.3.dist-info/WHEEL +4 -0
- toolframe_dashboard_auth-0.1.3.dist-info/entry_points.txt +2 -0
- toolframe_dashboard_auth-0.1.3.dist-info/licenses/LICENSE +202 -0
- toolframe_dashboard_auth-0.1.3.dist-info/licenses/NOTICE +2 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"""Login and access management presentation."""
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
"""Own-account delegation management backed by the shared authority."""
|
|
2
|
+
|
|
3
|
+
import time
|
|
4
|
+
|
|
5
|
+
from toolframe_sdk import PluginError
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
def render(context):
|
|
9
|
+
import streamlit as st
|
|
10
|
+
|
|
11
|
+
st.title("Connected agents")
|
|
12
|
+
st.caption(
|
|
13
|
+
"Each connection has its own permissions. Revoking an agent keeps your Dashboard session signed in."
|
|
14
|
+
)
|
|
15
|
+
try:
|
|
16
|
+
records = context.auth("grants")["grants"]
|
|
17
|
+
except PluginError as error:
|
|
18
|
+
st.info(error.message)
|
|
19
|
+
return
|
|
20
|
+
if not records:
|
|
21
|
+
st.info(
|
|
22
|
+
"No agents connected. Add this application's MCP URL in your agent to authorize a connection."
|
|
23
|
+
)
|
|
24
|
+
for record in records:
|
|
25
|
+
with st.container(border=True):
|
|
26
|
+
st.subheader(record["client_name"])
|
|
27
|
+
st.write(record["resource"])
|
|
28
|
+
st.write("Permissions: " + ", ".join(record["scopes"]))
|
|
29
|
+
if record["revoked_at"] is not None:
|
|
30
|
+
st.caption("Revoked")
|
|
31
|
+
elif record["expires_at"] <= time.time():
|
|
32
|
+
st.caption("Expired")
|
|
33
|
+
elif st.button("Revoke access", key="revoke-" + record["id"]):
|
|
34
|
+
try:
|
|
35
|
+
context.auth("revoke_grant", {"id": record["id"]})
|
|
36
|
+
st.rerun()
|
|
37
|
+
except PluginError as error:
|
|
38
|
+
st.error(error.message)
|
|
39
|
+
if st.button("Refresh connections"):
|
|
40
|
+
st.rerun()
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
<!doctype html>
|
|
2
|
+
<html lang="en"><meta charset="utf-8"><meta name="viewport" content="width=device-width,initial-scale=1">
|
|
3
|
+
<title>Sign in · Toolframe</title>
|
|
4
|
+
<style>
|
|
5
|
+
:root{color-scheme:light dark;font-family:system-ui,sans-serif}body{max-width:28rem;margin:15vh auto;padding:2rem}h1{font-size:2rem}label,input,button{display:block;width:100%;box-sizing:border-box}input,button{font:inherit;padding:.85rem;margin:.6rem 0 1.2rem;border-radius:.5rem;border:1px solid #888}button{cursor:pointer;background:#2369d8;color:white;border:0}#error{color:#e96565}p{line-height:1.5}a{color:#579aff}
|
|
6
|
+
</style>
|
|
7
|
+
<h1>Toolframe</h1><p>Sign in to open the Dashboard.</p>
|
|
8
|
+
<div id="identity-providers"></div>
|
|
9
|
+
<form method="post" action="/_toolframe/auth/login">
|
|
10
|
+
<label for="password">Access password</label><input id="password" name="password" type="password" required maxlength="1024" autocomplete="current-password" autofocus>
|
|
11
|
+
<button>Sign in</button><p id="error" role="alert"></p></form>
|
|
12
|
+
<p><a href="/_toolframe/session">Operator sign in</a></p>
|
|
13
|
+
<script>
|
|
14
|
+
fetch('/_toolframe/oidc/providers').then(response=>response.ok?response.json():{providers:[]}).then(data=>{
|
|
15
|
+
const target=document.querySelector('#identity-providers');
|
|
16
|
+
for(const provider of data.providers){const link=document.createElement('a');link.href=provider.url;link.textContent='Continue with '+provider.label;const row=document.createElement('p');row.append(link);target.append(row)}
|
|
17
|
+
}).catch(()=>{});
|
|
18
|
+
document.querySelector('form').addEventListener('submit',async event=>{
|
|
19
|
+
event.preventDefault();const button=document.querySelector('button'),error=document.querySelector('#error');button.disabled=true;error.textContent='';
|
|
20
|
+
try{const response=await fetch('/_toolframe/auth/login',{method:'POST',headers:{'Content-Type':'application/json','Accept':'application/json'},body:JSON.stringify({password:document.querySelector('#password').value})});
|
|
21
|
+
const data=await response.json();if(response.ok){location.assign('/')}else{error.textContent=data.error?.message||'Sign in failed. Please retry.'}}
|
|
22
|
+
catch{error.textContent='Connection interrupted. Please retry.'}finally{button.disabled=false}
|
|
23
|
+
});
|
|
24
|
+
</script></html>
|
|
@@ -0,0 +1,146 @@
|
|
|
1
|
+
"""MCP key presentation; key material is generated only by the credential service."""
|
|
2
|
+
|
|
3
|
+
import time
|
|
4
|
+
from urllib.parse import urlsplit, urlunsplit
|
|
5
|
+
|
|
6
|
+
from toolframe_sdk import PluginError
|
|
7
|
+
|
|
8
|
+
from .page import browser_timezone, expiry_fields, timestamp
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
def render(context):
|
|
12
|
+
import streamlit as st
|
|
13
|
+
|
|
14
|
+
st.title("MCP keys")
|
|
15
|
+
zone = browser_timezone(st.context.timezone, st.context.timezone_offset)
|
|
16
|
+
try:
|
|
17
|
+
settings = context.auth("mcp.catalog")
|
|
18
|
+
except PluginError as error:
|
|
19
|
+
st.error(error.message)
|
|
20
|
+
return
|
|
21
|
+
state = settings["status"]
|
|
22
|
+
if state["mode"] == "public":
|
|
23
|
+
st.warning("MCP is public. Enable protected access to require bearer keys.")
|
|
24
|
+
elif state["mode"] == "unavailable":
|
|
25
|
+
st.warning(
|
|
26
|
+
"Protected MCP is unavailable until its authentication provider is ready."
|
|
27
|
+
)
|
|
28
|
+
else:
|
|
29
|
+
st.success("MCP requires a bearer key for every request.")
|
|
30
|
+
if context.can("system.settings.manage"):
|
|
31
|
+
with st.expander("MCP access policy"):
|
|
32
|
+
mode = st.selectbox(
|
|
33
|
+
"MCP access",
|
|
34
|
+
["public", "protected"],
|
|
35
|
+
index=0 if settings["policy"]["mode"] == "public" else 1,
|
|
36
|
+
)
|
|
37
|
+
if st.button("Save MCP access policy"):
|
|
38
|
+
try:
|
|
39
|
+
context.auth(
|
|
40
|
+
"mcp.policy",
|
|
41
|
+
{"mode": mode, "expected_revision": settings["revision"]},
|
|
42
|
+
)
|
|
43
|
+
st.rerun()
|
|
44
|
+
except PluginError as error:
|
|
45
|
+
st.error(error.message)
|
|
46
|
+
if not state["provider_available"]:
|
|
47
|
+
st.info("Install and enable the MCP authentication plugin to manage keys.")
|
|
48
|
+
return
|
|
49
|
+
try:
|
|
50
|
+
records = context.auth("mcp.list")["keys"]
|
|
51
|
+
except PluginError as error:
|
|
52
|
+
st.error(error.message)
|
|
53
|
+
return
|
|
54
|
+
st.caption(
|
|
55
|
+
"Create a separate key for each client. Keys grant only the selected business permissions."
|
|
56
|
+
)
|
|
57
|
+
generation = st.session_state.get("mcp-draft-generation", 0)
|
|
58
|
+
prefix = f"mcp-key-{generation}"
|
|
59
|
+
with st.container(border=True):
|
|
60
|
+
st.subheader("New MCP key")
|
|
61
|
+
label = st.text_input(
|
|
62
|
+
"Name", value="Unnamed MCP key", max_chars=120, key=f"{prefix}-label"
|
|
63
|
+
)
|
|
64
|
+
catalog = settings["scopes"]
|
|
65
|
+
scopes = st.multiselect(
|
|
66
|
+
"Business permissions",
|
|
67
|
+
list(catalog),
|
|
68
|
+
format_func=lambda s: f"{catalog[s]['title']} ({s})",
|
|
69
|
+
key=f"{prefix}-scopes",
|
|
70
|
+
)
|
|
71
|
+
expiry = expiry_fields(st, prefix, zone=zone)
|
|
72
|
+
if settings["max_expires_at"] is not None:
|
|
73
|
+
st.caption(
|
|
74
|
+
f"Your grant permits keys expiring no later than {timestamp(settings['max_expires_at'], zone)}."
|
|
75
|
+
)
|
|
76
|
+
create = st.button("Generate key", type="primary")
|
|
77
|
+
if create:
|
|
78
|
+
try:
|
|
79
|
+
result = context.auth(
|
|
80
|
+
"mcp.create", {"label": label, "scopes": scopes, "expires_at": expiry}
|
|
81
|
+
)
|
|
82
|
+
except PluginError as error:
|
|
83
|
+
st.error(error.message)
|
|
84
|
+
else:
|
|
85
|
+
st.session_state["created-mcp-key"] = result["token"]
|
|
86
|
+
st.session_state["mcp-draft-generation"] = generation + 1
|
|
87
|
+
st.rerun()
|
|
88
|
+
token = st.session_state.pop("created-mcp-key", None)
|
|
89
|
+
if token:
|
|
90
|
+
st.success("Key created. Copy it now; it cannot be retrieved later.")
|
|
91
|
+
st.code(token, language=None)
|
|
92
|
+
st.code(f"Authorization: Bearer {token}", language=None)
|
|
93
|
+
if st.context.url:
|
|
94
|
+
location = urlsplit(st.context.url)
|
|
95
|
+
st.text_input(
|
|
96
|
+
"MCP URL",
|
|
97
|
+
value=urlunsplit((location.scheme, location.netloc, "/mcp", "", "")),
|
|
98
|
+
disabled=True,
|
|
99
|
+
)
|
|
100
|
+
else:
|
|
101
|
+
st.caption("MCP URL: your application's address followed by /mcp.")
|
|
102
|
+
st.caption(
|
|
103
|
+
"Use HTTPS for remote connections and configure the Authorization header in your MCP client."
|
|
104
|
+
)
|
|
105
|
+
st.subheader("Key records")
|
|
106
|
+
now = time.time()
|
|
107
|
+
st.dataframe(
|
|
108
|
+
[
|
|
109
|
+
{
|
|
110
|
+
"Name": row["label"],
|
|
111
|
+
"Key": row["masked_key"],
|
|
112
|
+
"Permissions": ", ".join(row["scopes"]),
|
|
113
|
+
"Status": "Revoked"
|
|
114
|
+
if row["revoked_at"] is not None
|
|
115
|
+
else "Expired"
|
|
116
|
+
if row["expires_at"] is not None and row["expires_at"] <= now
|
|
117
|
+
else "Active",
|
|
118
|
+
"Created": timestamp(row["created_at"], zone),
|
|
119
|
+
"Expires": timestamp(row["expires_at"], zone),
|
|
120
|
+
"Last used": timestamp(row["last_used"], zone),
|
|
121
|
+
}
|
|
122
|
+
for row in records
|
|
123
|
+
],
|
|
124
|
+
hide_index=True,
|
|
125
|
+
width="stretch",
|
|
126
|
+
)
|
|
127
|
+
if st.button("Refresh keys"):
|
|
128
|
+
st.rerun()
|
|
129
|
+
active = [row for row in records if row["revoked_at"] is None]
|
|
130
|
+
if active:
|
|
131
|
+
identifier = st.selectbox(
|
|
132
|
+
"Key to revoke",
|
|
133
|
+
[row["id"] for row in active],
|
|
134
|
+
format_func=lambda key: next(
|
|
135
|
+
f"{row['label']} ({key[:8]})" for row in active if row["id"] == key
|
|
136
|
+
),
|
|
137
|
+
)
|
|
138
|
+
if st.button("Revoke key"):
|
|
139
|
+
try:
|
|
140
|
+
context.auth("mcp.revoke", {"id": identifier})
|
|
141
|
+
st.rerun()
|
|
142
|
+
except PluginError as error:
|
|
143
|
+
st.error(error.message)
|
|
144
|
+
st.caption(
|
|
145
|
+
"To rotate a key, generate a replacement, update the client, then revoke the old key."
|
|
146
|
+
)
|
|
@@ -0,0 +1,338 @@
|
|
|
1
|
+
"""UI-only auth integration; credentials remain in the auth service."""
|
|
2
|
+
|
|
3
|
+
import calendar
|
|
4
|
+
import secrets
|
|
5
|
+
from datetime import UTC, datetime, timedelta, timezone
|
|
6
|
+
from zoneinfo import ZoneInfo, ZoneInfoNotFoundError
|
|
7
|
+
|
|
8
|
+
from toolframe_sdk import PluginError
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
def browser_timezone(name, offset):
|
|
12
|
+
if name:
|
|
13
|
+
try:
|
|
14
|
+
return ZoneInfo(name)
|
|
15
|
+
except ZoneInfoNotFoundError, ValueError:
|
|
16
|
+
pass
|
|
17
|
+
if offset is not None and -1440 < offset < 1440:
|
|
18
|
+
return timezone(-timedelta(minutes=offset))
|
|
19
|
+
return UTC
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
def timestamp(value, zone=UTC):
|
|
23
|
+
return (
|
|
24
|
+
datetime.fromtimestamp(value, zone).strftime("%Y-%m-%d %H:%M:%S %Z")
|
|
25
|
+
if value is not None
|
|
26
|
+
else "—"
|
|
27
|
+
)
|
|
28
|
+
|
|
29
|
+
|
|
30
|
+
def unnamed_label(records):
|
|
31
|
+
labels = {record["label"] for record in records}
|
|
32
|
+
label, number = "Unnamed password", 1
|
|
33
|
+
while label in labels:
|
|
34
|
+
number += 1
|
|
35
|
+
label = f"Unnamed password {number}"
|
|
36
|
+
return label
|
|
37
|
+
|
|
38
|
+
|
|
39
|
+
def expiry_after(now, amount, unit):
|
|
40
|
+
if unit == "Months":
|
|
41
|
+
month = now.year * 12 + now.month - 1 + amount
|
|
42
|
+
year, month = divmod(month, 12)
|
|
43
|
+
month += 1
|
|
44
|
+
return now.replace(
|
|
45
|
+
year=year,
|
|
46
|
+
month=month,
|
|
47
|
+
day=min(now.day, calendar.monthrange(year, month)[1]),
|
|
48
|
+
).timestamp()
|
|
49
|
+
seconds = {"Minutes": 60, "Hours": 3600, "Days": 86400, "Weeks": 604800}[unit]
|
|
50
|
+
return now.timestamp() + amount * seconds
|
|
51
|
+
|
|
52
|
+
|
|
53
|
+
def expiry_fields(st, prefix, expiry=None, zone=UTC):
|
|
54
|
+
limited = st.checkbox(
|
|
55
|
+
"Set expiry", value=expiry is not None, key=f"{prefix}-limited"
|
|
56
|
+
)
|
|
57
|
+
if not limited:
|
|
58
|
+
return None
|
|
59
|
+
with st.container(key=f"expiry-controls-{prefix}"):
|
|
60
|
+
duration_column, unit_column = st.columns(2, gap="small")
|
|
61
|
+
amount = duration_column.number_input(
|
|
62
|
+
"Expire after",
|
|
63
|
+
min_value=1,
|
|
64
|
+
max_value=3650,
|
|
65
|
+
value=None if expiry is not None else 1,
|
|
66
|
+
step=1,
|
|
67
|
+
placeholder="Keep current expiry",
|
|
68
|
+
help="From the time you save. Leave blank to keep an existing expiry.",
|
|
69
|
+
key=f"{prefix}-duration",
|
|
70
|
+
)
|
|
71
|
+
unit = unit_column.selectbox(
|
|
72
|
+
"Unit",
|
|
73
|
+
["Minutes", "Hours", "Days", "Weeks", "Months"],
|
|
74
|
+
index=3,
|
|
75
|
+
key=f"{prefix}-unit",
|
|
76
|
+
)
|
|
77
|
+
result = expiry_after(datetime.now(zone), amount, unit) if amount else expiry
|
|
78
|
+
if result is not None:
|
|
79
|
+
st.caption(f"Expires on {timestamp(result, zone)}")
|
|
80
|
+
else:
|
|
81
|
+
st.caption("Enter a duration to set an expiry.")
|
|
82
|
+
return result
|
|
83
|
+
|
|
84
|
+
|
|
85
|
+
def grant_fields(st, catalog, prefix, record=None, default_label="", zone=UTC):
|
|
86
|
+
record = record or {}
|
|
87
|
+
label = st.text_input(
|
|
88
|
+
"Name",
|
|
89
|
+
value=record.get("label", default_label),
|
|
90
|
+
max_chars=120,
|
|
91
|
+
key=f"{prefix}-label",
|
|
92
|
+
)
|
|
93
|
+
all_business = st.checkbox(
|
|
94
|
+
"All business scopes (including future plugins)",
|
|
95
|
+
value=record.get("all_business", True),
|
|
96
|
+
key=f"{prefix}-all",
|
|
97
|
+
)
|
|
98
|
+
scopes = []
|
|
99
|
+
owners = sorted({item["owner"] for item in catalog.values()})
|
|
100
|
+
for owner in owners:
|
|
101
|
+
options = [name for name, item in catalog.items() if item["owner"] == owner]
|
|
102
|
+
selected = st.multiselect(
|
|
103
|
+
f"{owner} scopes",
|
|
104
|
+
options,
|
|
105
|
+
default=[s for s in record.get("scopes", []) if s in options],
|
|
106
|
+
format_func=lambda s: f"{catalog[s]['title']} ({s})",
|
|
107
|
+
key=f"{prefix}-{owner}",
|
|
108
|
+
)
|
|
109
|
+
scopes.extend(selected)
|
|
110
|
+
return {
|
|
111
|
+
"label": label.strip() or default_label,
|
|
112
|
+
"scopes": scopes,
|
|
113
|
+
"all_business": all_business,
|
|
114
|
+
"expires_at": expiry_fields(st, prefix, record.get("expires_at"), zone),
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
|
|
118
|
+
def render(context):
|
|
119
|
+
import streamlit as st
|
|
120
|
+
|
|
121
|
+
zone = browser_timezone(st.context.timezone, st.context.timezone_offset)
|
|
122
|
+
# Streamlit stacks columns below 640px; this short pair still fits side by side.
|
|
123
|
+
st.html("""<style>
|
|
124
|
+
[class*="st-key-expiry-controls-"] [data-testid="stHorizontalBlock"] {
|
|
125
|
+
flex-wrap: nowrap;
|
|
126
|
+
}
|
|
127
|
+
[class*="st-key-expiry-controls-"] [data-testid="stColumn"] {
|
|
128
|
+
min-width: 0; flex: 1 1 0; width: 0;
|
|
129
|
+
}
|
|
130
|
+
</style>""")
|
|
131
|
+
st.title("Access passwords")
|
|
132
|
+
try:
|
|
133
|
+
settings = context.auth("catalog")
|
|
134
|
+
except PluginError as error:
|
|
135
|
+
st.error(error.message)
|
|
136
|
+
return
|
|
137
|
+
entrances = settings.get("entrances")
|
|
138
|
+
if entrances:
|
|
139
|
+
with st.expander("Access by entrance", expanded=True):
|
|
140
|
+
dashboard, mcp = entrances["dashboard"], entrances["mcp"]
|
|
141
|
+
st.markdown(
|
|
142
|
+
f"**Dashboard and service calls:** {dashboard['mode']} "
|
|
143
|
+
f"(configured: {dashboard['configured']}). "
|
|
144
|
+
f"**MCP:** {mcp['mode']} (configured: {mcp['configured']})."
|
|
145
|
+
)
|
|
146
|
+
st.caption(
|
|
147
|
+
"MCP uses its own policy and credentials. Manage it on the MCP keys page. "
|
|
148
|
+
"Dashboard passwords do not protect explicitly public HTTP methods or llms.txt."
|
|
149
|
+
)
|
|
150
|
+
st.caption(
|
|
151
|
+
f"Direct local control: {'enabled' if settings['policy']['local_control'] else 'disabled'}. "
|
|
152
|
+
f"Current caller: {entrances['actor']}. System operations still require operator authority or system scopes."
|
|
153
|
+
)
|
|
154
|
+
public = entrances["declared_public_api"]
|
|
155
|
+
st.markdown("**Declared public HTTP methods**")
|
|
156
|
+
for path in public:
|
|
157
|
+
st.caption(path)
|
|
158
|
+
if not public:
|
|
159
|
+
st.caption("No public HTTP methods declared by installed plugins.")
|
|
160
|
+
st.caption(
|
|
161
|
+
"Declared methods are served only while their plugin is available."
|
|
162
|
+
)
|
|
163
|
+
if context.can("system.settings.manage"):
|
|
164
|
+
with st.expander("Application access policy"):
|
|
165
|
+
mode = st.selectbox(
|
|
166
|
+
"Dashboard access",
|
|
167
|
+
["public", "protected"],
|
|
168
|
+
index=0 if settings["policy"]["mode"] == "public" else 1,
|
|
169
|
+
)
|
|
170
|
+
local = st.checkbox(
|
|
171
|
+
"Allow direct local control", value=settings["policy"]["local_control"]
|
|
172
|
+
)
|
|
173
|
+
failure = None
|
|
174
|
+
if "failure_modes" in settings.get("policy_options", {}):
|
|
175
|
+
failure = st.selectbox(
|
|
176
|
+
"When Dashboard authentication is unavailable",
|
|
177
|
+
["closed", "public"],
|
|
178
|
+
index=0 if settings["policy"]["failure_mode"] == "closed" else 1,
|
|
179
|
+
format_func=lambda value: {
|
|
180
|
+
"closed": "Deny protected business access (recommended)",
|
|
181
|
+
"public": "Allow anonymous business access",
|
|
182
|
+
}[value],
|
|
183
|
+
)
|
|
184
|
+
if failure == "public":
|
|
185
|
+
st.warning(
|
|
186
|
+
"If authentication fails or is disabled, anonymous visitors receive all business scopes."
|
|
187
|
+
)
|
|
188
|
+
st.caption(
|
|
189
|
+
"This applies to protected Dashboard/service access. MCP and public HTTP keep their own rules."
|
|
190
|
+
)
|
|
191
|
+
else:
|
|
192
|
+
st.caption(
|
|
193
|
+
"This Core version cannot edit the authentication failure policy here."
|
|
194
|
+
)
|
|
195
|
+
if st.button("Save access policy"):
|
|
196
|
+
try:
|
|
197
|
+
context.auth(
|
|
198
|
+
"policy",
|
|
199
|
+
{
|
|
200
|
+
"mode": mode,
|
|
201
|
+
"local_control": local,
|
|
202
|
+
"expected_revision": settings["revision"],
|
|
203
|
+
**(
|
|
204
|
+
{"failure_mode": failure} if failure is not None else {}
|
|
205
|
+
),
|
|
206
|
+
},
|
|
207
|
+
)
|
|
208
|
+
st.rerun()
|
|
209
|
+
except PluginError as error:
|
|
210
|
+
st.error(error.message)
|
|
211
|
+
st.caption(
|
|
212
|
+
"System scopes are excluded by default. Names identify grants, not people. MCP has a separate access policy. llms.txt and explicitly public business APIs stay public."
|
|
213
|
+
)
|
|
214
|
+
try:
|
|
215
|
+
records = context.auth("list")["credentials"]
|
|
216
|
+
except PluginError as error:
|
|
217
|
+
st.error(error.message)
|
|
218
|
+
return
|
|
219
|
+
if "password-draft" not in st.session_state:
|
|
220
|
+
st.session_state["password-draft"] = {
|
|
221
|
+
"key": f"new-{secrets.token_hex(8)}",
|
|
222
|
+
"label": unnamed_label(records),
|
|
223
|
+
"password": secrets.token_urlsafe(24),
|
|
224
|
+
}
|
|
225
|
+
draft = st.session_state["password-draft"]
|
|
226
|
+
# Regular widgets rerun immediately, so the expiry toggle can reveal its fields.
|
|
227
|
+
with st.container(border=True):
|
|
228
|
+
st.subheader("New access password")
|
|
229
|
+
fields = grant_fields(
|
|
230
|
+
st,
|
|
231
|
+
settings["scopes"],
|
|
232
|
+
draft["key"],
|
|
233
|
+
default_label=draft["label"],
|
|
234
|
+
zone=zone,
|
|
235
|
+
)
|
|
236
|
+
custom = st.text_input(
|
|
237
|
+
"Password (8–32 characters)",
|
|
238
|
+
type="password",
|
|
239
|
+
max_chars=32,
|
|
240
|
+
placeholder=draft["password"],
|
|
241
|
+
help="Leave blank to use the suggested password. Copy it after creation.",
|
|
242
|
+
key=f"{draft['key']}-password",
|
|
243
|
+
)
|
|
244
|
+
create = st.button("Create password")
|
|
245
|
+
if create:
|
|
246
|
+
password = custom or draft["password"]
|
|
247
|
+
try:
|
|
248
|
+
if not 8 <= len(password) <= 32:
|
|
249
|
+
raise PluginError(
|
|
250
|
+
"invalid_request", "Passwords must contain 8–32 characters"
|
|
251
|
+
)
|
|
252
|
+
if (
|
|
253
|
+
st.session_state[f"{draft['key']}-limited"]
|
|
254
|
+
and fields["expires_at"] is None
|
|
255
|
+
):
|
|
256
|
+
raise PluginError("invalid_request", "Enter an expiry duration")
|
|
257
|
+
result = context.auth(
|
|
258
|
+
"create",
|
|
259
|
+
{
|
|
260
|
+
**fields,
|
|
261
|
+
"password": password,
|
|
262
|
+
"expected_revision": settings["revision"],
|
|
263
|
+
},
|
|
264
|
+
)
|
|
265
|
+
except PluginError as error:
|
|
266
|
+
st.error(error.message)
|
|
267
|
+
else:
|
|
268
|
+
st.session_state["created-password"] = {
|
|
269
|
+
"password": password,
|
|
270
|
+
"policy_error": result.get("policy_error"),
|
|
271
|
+
}
|
|
272
|
+
del st.session_state["password-draft"]
|
|
273
|
+
st.rerun()
|
|
274
|
+
created = st.session_state.pop("created-password", None)
|
|
275
|
+
if created:
|
|
276
|
+
st.success("Password created. Copy it now; it cannot be retrieved later.")
|
|
277
|
+
st.code(created["password"], language=None)
|
|
278
|
+
if created["policy_error"]:
|
|
279
|
+
st.error(created["policy_error"])
|
|
280
|
+
st.subheader("Password records")
|
|
281
|
+
st.dataframe(
|
|
282
|
+
[
|
|
283
|
+
{
|
|
284
|
+
**{k: v for k, v in row.items() if k not in {"scopes", "all_business"}},
|
|
285
|
+
"scopes": ", ".join(row["scopes"]),
|
|
286
|
+
"all_business": row["all_business"],
|
|
287
|
+
**{
|
|
288
|
+
k: timestamp(row[k], zone)
|
|
289
|
+
for k in (
|
|
290
|
+
"created_at",
|
|
291
|
+
"expires_at",
|
|
292
|
+
"revoked_at",
|
|
293
|
+
"last_login",
|
|
294
|
+
"last_used",
|
|
295
|
+
)
|
|
296
|
+
},
|
|
297
|
+
}
|
|
298
|
+
for row in records
|
|
299
|
+
],
|
|
300
|
+
hide_index=True,
|
|
301
|
+
width="stretch",
|
|
302
|
+
)
|
|
303
|
+
if st.button("Refresh records"):
|
|
304
|
+
st.rerun()
|
|
305
|
+
if records:
|
|
306
|
+
identifier = st.selectbox(
|
|
307
|
+
"Password record",
|
|
308
|
+
[r["id"] for r in records],
|
|
309
|
+
format_func=lambda key: next(r["label"] for r in records if r["id"] == key),
|
|
310
|
+
)
|
|
311
|
+
record = next(r for r in records if r["id"] == identifier)
|
|
312
|
+
if record["revoked_at"] is not None:
|
|
313
|
+
st.info("Revoked. Create a new record to issue a new authorization.")
|
|
314
|
+
return
|
|
315
|
+
edit_key = f"{identifier}-{st.session_state.get('grant-edit-generation', 0)}"
|
|
316
|
+
with st.container(border=True):
|
|
317
|
+
fields = grant_fields(st, settings["scopes"], edit_key, record, zone=zone)
|
|
318
|
+
edit = st.button("Save password grant")
|
|
319
|
+
if edit:
|
|
320
|
+
try:
|
|
321
|
+
if (
|
|
322
|
+
st.session_state[f"{edit_key}-limited"]
|
|
323
|
+
and fields["expires_at"] is None
|
|
324
|
+
):
|
|
325
|
+
raise PluginError("invalid_request", "Enter an expiry duration")
|
|
326
|
+
context.auth("update", {"id": identifier, **fields})
|
|
327
|
+
st.session_state["grant-edit-generation"] = (
|
|
328
|
+
st.session_state.get("grant-edit-generation", 0) + 1
|
|
329
|
+
)
|
|
330
|
+
st.rerun()
|
|
331
|
+
except PluginError as error:
|
|
332
|
+
st.error(error.message)
|
|
333
|
+
if st.button("Revoke password", type="primary"):
|
|
334
|
+
try:
|
|
335
|
+
context.auth("revoke", {"id": identifier})
|
|
336
|
+
st.rerun()
|
|
337
|
+
except PluginError as error:
|
|
338
|
+
st.error(error.message)
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
from importlib.resources import files
|
|
2
|
+
|
|
3
|
+
from toolframe_sdk import (
|
|
4
|
+
AuthorizationSpec,
|
|
5
|
+
MethodSpec,
|
|
6
|
+
Plugin,
|
|
7
|
+
PluginDefinition,
|
|
8
|
+
Requirement,
|
|
9
|
+
Resource,
|
|
10
|
+
ServiceSpec,
|
|
11
|
+
)
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
class DashboardAuth(Plugin):
|
|
15
|
+
async def invoke(self, service, method, params):
|
|
16
|
+
return {
|
|
17
|
+
"html": files("toolframe_dashboard_auth").joinpath("login.html").read_text()
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
|
|
21
|
+
plugin = PluginDefinition(
|
|
22
|
+
id="dashboard-auth",
|
|
23
|
+
kind="provider",
|
|
24
|
+
provider_kind="dashboard-auth",
|
|
25
|
+
factory="toolframe_dashboard_auth.plugin:DashboardAuth",
|
|
26
|
+
authorization=AuthorizationSpec(),
|
|
27
|
+
requires={"auth": Requirement(service="toolframe.auth")},
|
|
28
|
+
services={
|
|
29
|
+
"dashboard-auth.presentation": ServiceSpec(
|
|
30
|
+
methods={"login": MethodSpec(audience="internal", read_only=True)}
|
|
31
|
+
)
|
|
32
|
+
},
|
|
33
|
+
resources=(
|
|
34
|
+
Resource(
|
|
35
|
+
id="connections",
|
|
36
|
+
kind="dashboard.page",
|
|
37
|
+
title="Connected agents",
|
|
38
|
+
required_scopes=("system.auth.self",),
|
|
39
|
+
data={
|
|
40
|
+
"entrypoint": "toolframe_dashboard_auth.connections:render",
|
|
41
|
+
"order": 890,
|
|
42
|
+
},
|
|
43
|
+
),
|
|
44
|
+
Resource(
|
|
45
|
+
id="users",
|
|
46
|
+
kind="dashboard.page",
|
|
47
|
+
title="User access",
|
|
48
|
+
required_scopes=("system.auth.users",),
|
|
49
|
+
data={"entrypoint": "toolframe_dashboard_auth.users:render", "order": 895},
|
|
50
|
+
),
|
|
51
|
+
Resource(
|
|
52
|
+
id="passwords",
|
|
53
|
+
kind="dashboard.page",
|
|
54
|
+
title="Access passwords",
|
|
55
|
+
required_scopes=("system.auth.passwords",),
|
|
56
|
+
data={"entrypoint": "toolframe_dashboard_auth.page:render", "order": 900},
|
|
57
|
+
),
|
|
58
|
+
Resource(
|
|
59
|
+
id="mcp-keys",
|
|
60
|
+
kind="dashboard.page",
|
|
61
|
+
title="MCP keys",
|
|
62
|
+
required_scopes=("system.auth.mcp_keys",),
|
|
63
|
+
data={
|
|
64
|
+
"entrypoint": "toolframe_dashboard_auth.mcp_page:render",
|
|
65
|
+
"order": 910,
|
|
66
|
+
},
|
|
67
|
+
),
|
|
68
|
+
),
|
|
69
|
+
)
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
"""Administration of admitted federated users; no provider tokens enter the UI."""
|
|
2
|
+
|
|
3
|
+
from toolframe_sdk import PluginError
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
def render(context):
|
|
7
|
+
import streamlit as st
|
|
8
|
+
|
|
9
|
+
st.title("User access")
|
|
10
|
+
st.caption(
|
|
11
|
+
"External identities are admitted through application configuration. Manage their local permissions here after their first sign-in."
|
|
12
|
+
)
|
|
13
|
+
try:
|
|
14
|
+
settings = context.auth("user_catalog")
|
|
15
|
+
users = context.auth("users")["users"]
|
|
16
|
+
except PluginError as error:
|
|
17
|
+
st.error(error.message)
|
|
18
|
+
return
|
|
19
|
+
if not users:
|
|
20
|
+
st.info("No admitted users have signed in yet.")
|
|
21
|
+
return
|
|
22
|
+
by_id = {user["id"]: user for user in users}
|
|
23
|
+
identifier = st.selectbox(
|
|
24
|
+
"User", list(by_id), format_func=lambda key: by_id[key]["label"]
|
|
25
|
+
)
|
|
26
|
+
user = by_id[identifier]
|
|
27
|
+
scopes = st.multiselect(
|
|
28
|
+
"Permissions",
|
|
29
|
+
list(settings["scopes"]),
|
|
30
|
+
default=[scope for scope in user["scopes"] if scope in settings["scopes"]],
|
|
31
|
+
key="user-scopes-" + identifier,
|
|
32
|
+
)
|
|
33
|
+
disabled = st.checkbox(
|
|
34
|
+
"Disable user", value=bool(user["disabled"]), key="user-disabled-" + identifier
|
|
35
|
+
)
|
|
36
|
+
if st.button("Save user access"):
|
|
37
|
+
try:
|
|
38
|
+
context.auth(
|
|
39
|
+
"user_update",
|
|
40
|
+
{
|
|
41
|
+
"id": identifier,
|
|
42
|
+
"scopes": scopes,
|
|
43
|
+
"disabled": disabled,
|
|
44
|
+
"expires_at": user["expires_at"],
|
|
45
|
+
},
|
|
46
|
+
)
|
|
47
|
+
st.success("User access saved.")
|
|
48
|
+
except PluginError as error:
|
|
49
|
+
st.error(error.message)
|
|
50
|
+
st.caption(
|
|
51
|
+
"Permission reductions affect existing connections. Disabling a user also revokes their sessions and agent grants."
|
|
52
|
+
)
|
|
@@ -0,0 +1,106 @@
|
|
|
1
|
+
Metadata-Version: 2.5
|
|
2
|
+
Name: toolframe-dashboard-auth
|
|
3
|
+
Version: 0.1.3
|
|
4
|
+
Summary: Password login and access management pages for Toolframe
|
|
5
|
+
Project-URL: Homepage, https://github.com/toolframe/toolframe-dashboard-auth
|
|
6
|
+
Project-URL: Repository, https://github.com/toolframe/toolframe-dashboard-auth
|
|
7
|
+
Project-URL: Documentation, https://github.com/toolframe/toolframe-dashboard-auth#readme
|
|
8
|
+
Project-URL: Issues, https://github.com/toolframe/toolframe-dashboard-auth/issues
|
|
9
|
+
Author-email: byfb <62798989+byfb@users.noreply.github.com>
|
|
10
|
+
License-Expression: Apache-2.0
|
|
11
|
+
License-File: LICENSE
|
|
12
|
+
License-File: NOTICE
|
|
13
|
+
Requires-Python: >=3.14
|
|
14
|
+
Requires-Dist: toolframe-sdk<0.4,>=0.2
|
|
15
|
+
Provides-Extra: ui
|
|
16
|
+
Requires-Dist: streamlit==1.61.0; extra == 'ui'
|
|
17
|
+
Description-Content-Type: text/markdown
|
|
18
|
+
|
|
19
|
+
# Toolframe Dashboard Auth
|
|
20
|
+
|
|
21
|
+
The `dashboard-auth` provider supplies password and configured OIDC login choices,
|
|
22
|
+
plus Streamlit access-management pages. It depends on the `toolframe.auth` service
|
|
23
|
+
and SDK 0.2–0.3. Core handles cookies, admission and protected auth API calls; this
|
|
24
|
+
plugin holds no credential database or verifier key.
|
|
25
|
+
|
|
26
|
+
Install the package in a running application with compatible Auth and Dashboard
|
|
27
|
+
providers, then open **Access passwords** as a local operator:
|
|
28
|
+
|
|
29
|
+
```sh
|
|
30
|
+
toolframe --home APP plugin add pypi:toolframe-dashboard-auth==0.1.3 --enable
|
|
31
|
+
```
|
|
32
|
+
|
|
33
|
+
With Core 0.6.1, **Access by entrance** reports Dashboard/service access, independent
|
|
34
|
+
MCP policy, declared public HTTP methods and the current local/operator context.
|
|
35
|
+
The policy form lets settings administrators choose closed or public behavior
|
|
36
|
+
when Dashboard authentication fails. Closed is the default for new applications;
|
|
37
|
+
existing application choices are preserved. Older Core versions keep the existing
|
|
38
|
+
policy controls but do not offer the unsupported failure-policy editor. Public
|
|
39
|
+
HTTP declarations and llms documents remain public, and method scopes do not
|
|
40
|
+
provide per-person row isolation.
|
|
41
|
+
While this page is available, credential-list errors leave its policy controls
|
|
42
|
+
usable by local operators. If Dashboard Auth itself is unavailable, use Core's
|
|
43
|
+
local management API for recovery.
|
|
44
|
+
|
|
45
|
+
With compatible Core/Auth and `toolframe-oidc-auth` installed, the login page
|
|
46
|
+
loads provider buttons from Core's safe provider catalogue. **Connected agents**
|
|
47
|
+
requires `system.auth.self` and lets a federated user revoke their own connections
|
|
48
|
+
without logging out. **User access** requires `system.auth.users` and manages
|
|
49
|
+
permissions/disablement for identities already admitted by application
|
|
50
|
+
configuration. Disabling a user revokes their browser sessions and agent grants.
|
|
51
|
+
The pages call Core's protected facade; no upstream credentials enter Streamlit.
|
|
52
|
+
|
|
53
|
+
The optional **MCP keys** page requires `system.auth.mcp_keys` and manages named
|
|
54
|
+
256-bit bearer keys through core's separate MCP auth API. Install/enable
|
|
55
|
+
`toolframe-mcp-auth` to generate keys, select business scopes and expiry, copy each
|
|
56
|
+
secret once and revoke it later. `system.settings.manage` also permits changing
|
|
57
|
+
the independent MCP public/protected policy. The page remains available for policy
|
|
58
|
+
recovery when the MCP auth provider is absent. See the MCP authentication guide
|
|
59
|
+
in the core repository for configuration details.
|
|
60
|
+
|
|
61
|
+
The management page fills in an editable **Unnamed password** label, adding a
|
|
62
|
+
number for names already in use. The password field accepts 8–32 characters and
|
|
63
|
+
shows a stable random suggestion as its placeholder. Leave the field blank to use
|
|
64
|
+
that exact suggestion; after creation, copy the one-time displayed password.
|
|
65
|
+
Failed submissions preserve the draft; successful creation starts a fresh one.
|
|
66
|
+
|
|
67
|
+
**Set expiry** immediately reveals a duration and unit side by side, with minutes,
|
|
68
|
+
hours, days, weeks or calendar months and a calculated local expiry preview.
|
|
69
|
+
Preview and record timestamps use the browser's timezone (its UTC offset is a
|
|
70
|
+
fallback, then UTC if neither is available). Durations start when saved; months
|
|
71
|
+
follow that local calendar and clamp to the destination month's last day. Other
|
|
72
|
+
units measure elapsed time, including across daylight-saving changes. No
|
|
73
|
+
date/time entry is needed.
|
|
74
|
+
Turning expiry off hides the controls and saves no expiry. When editing, leave the
|
|
75
|
+
duration blank to preserve the exact existing expiry, or enter a duration to
|
|
76
|
+
replace it. Saving other grant fields never silently extends the expiry.
|
|
77
|
+
|
|
78
|
+
The page selects scopes, edits grants, revokes records and shows creation,
|
|
79
|
+
last-login and last-use timestamps. Its page
|
|
80
|
+
requires `system.auth.passwords`; access-policy controls additionally require
|
|
81
|
+
`system.settings.manage`. Core/auth enforce the same rules beyond the UI.
|
|
82
|
+
|
|
83
|
+
Core serves the login page at `/_toolframe/auth/login`. The existing Dashboard
|
|
84
|
+
provider owns the common local/public/protected header so it remains available
|
|
85
|
+
when this integration fails or is disabled. Streamlit is supplied by the shared
|
|
86
|
+
Dashboard execution environment, not the business/auth worker.
|
|
87
|
+
|
|
88
|
+
```sh
|
|
89
|
+
uv sync
|
|
90
|
+
uv run pytest -q
|
|
91
|
+
uv run ruff check src tests
|
|
92
|
+
uv build --wheel
|
|
93
|
+
```
|
|
94
|
+
|
|
95
|
+
For the same isolated validation used by GitHub Actions, run `bash scripts/ci.sh`
|
|
96
|
+
with Python 3.14.7, uv 0.12.8 and a sibling `toolframe-sdk` Git checkout available.
|
|
97
|
+
This runs the presentation tests against a newly built wheel, checks both
|
|
98
|
+
distributions, and verifies a separate installation with only runtime dependencies.
|
|
99
|
+
See [CI and publishing](docs/ci.md) for the pinned SDK revision, workflow triggers,
|
|
100
|
+
release prerequisites and local validation limits.
|
|
101
|
+
|
|
102
|
+
For release validation and Trusted Publisher setup, see [releasing](docs/releasing.md).
|
|
103
|
+
|
|
104
|
+
## License
|
|
105
|
+
|
|
106
|
+
Licensed under the Apache License, Version 2.0. See [LICENSE](LICENSE) and [NOTICE](NOTICE).
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
toolframe_dashboard_auth/__init__.py,sha256=_E2k7r37iXtb0I16etnkMCEgX1PUL5zBQkPkikWddeI,48
|
|
2
|
+
toolframe_dashboard_auth/connections.py,sha256=85Soev_cdH2qDA79fBJmV1RfQpTQwew2Eb2TAPEUE-k,1382
|
|
3
|
+
toolframe_dashboard_auth/login.html,sha256=aUaikJX9LmsYn6EGvtigvS7UAKiqa3dk5Rt65lohB3Y,2161
|
|
4
|
+
toolframe_dashboard_auth/mcp_page.py,sha256=86feBt3XmP4SWPMRdacGhBKOUAWIpWsmvPtRsG5v8rw,5432
|
|
5
|
+
toolframe_dashboard_auth/page.py,sha256=qFd8qJx4cmNPYYkfOc3ziCHdA3WkvZ4TPkWM1vM2DsA,12833
|
|
6
|
+
toolframe_dashboard_auth/plugin.py,sha256=Nl1ZmwQQqOHDk5wW3G7j-6Ut00BfIq3WpLvpW53U0cg,2023
|
|
7
|
+
toolframe_dashboard_auth/users.py,sha256=88uXpsB-xFPzQKZ8bFo8WYf75Q_GHW9FdPX-s9Y81A8,1760
|
|
8
|
+
toolframe_dashboard_auth-0.1.3.dist-info/METADATA,sha256=HlgeTTcw984JngCnQpVTBgIaGyVjf0VYRYT-8qsaBng,5652
|
|
9
|
+
toolframe_dashboard_auth-0.1.3.dist-info/WHEEL,sha256=W3fkpkm7-wf9vBI5Z-7s0eWkeM-spu78I8Neb98DeEg,87
|
|
10
|
+
toolframe_dashboard_auth-0.1.3.dist-info/entry_points.txt,sha256=bpL7Pz-rrx9tFpDQFnM_8FJr03g_YszmJD50ryjiG5A,76
|
|
11
|
+
toolframe_dashboard_auth-0.1.3.dist-info/licenses/LICENSE,sha256=z8d0m5b2O9McPEK1xHG_dWgUBT6EfBDz6wA0F7xSPTA,11358
|
|
12
|
+
toolframe_dashboard_auth-0.1.3.dist-info/licenses/NOTICE,sha256=2OqhMZQ58LnnFMuKDOyip9m_S6Gvf4_HcAEBiyHt4mw,45
|
|
13
|
+
toolframe_dashboard_auth-0.1.3.dist-info/RECORD,,
|
|
@@ -0,0 +1,202 @@
|
|
|
1
|
+
|
|
2
|
+
Apache License
|
|
3
|
+
Version 2.0, January 2004
|
|
4
|
+
http://www.apache.org/licenses/
|
|
5
|
+
|
|
6
|
+
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
|
7
|
+
|
|
8
|
+
1. Definitions.
|
|
9
|
+
|
|
10
|
+
"License" shall mean the terms and conditions for use, reproduction,
|
|
11
|
+
and distribution as defined by Sections 1 through 9 of this document.
|
|
12
|
+
|
|
13
|
+
"Licensor" shall mean the copyright owner or entity authorized by
|
|
14
|
+
the copyright owner that is granting the License.
|
|
15
|
+
|
|
16
|
+
"Legal Entity" shall mean the union of the acting entity and all
|
|
17
|
+
other entities that control, are controlled by, or are under common
|
|
18
|
+
control with that entity. For the purposes of this definition,
|
|
19
|
+
"control" means (i) the power, direct or indirect, to cause the
|
|
20
|
+
direction or management of such entity, whether by contract or
|
|
21
|
+
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
|
22
|
+
outstanding shares, or (iii) beneficial ownership of such entity.
|
|
23
|
+
|
|
24
|
+
"You" (or "Your") shall mean an individual or Legal Entity
|
|
25
|
+
exercising permissions granted by this License.
|
|
26
|
+
|
|
27
|
+
"Source" form shall mean the preferred form for making modifications,
|
|
28
|
+
including but not limited to software source code, documentation
|
|
29
|
+
source, and configuration files.
|
|
30
|
+
|
|
31
|
+
"Object" form shall mean any form resulting from mechanical
|
|
32
|
+
transformation or translation of a Source form, including but
|
|
33
|
+
not limited to compiled object code, generated documentation,
|
|
34
|
+
and conversions to other media types.
|
|
35
|
+
|
|
36
|
+
"Work" shall mean the work of authorship, whether in Source or
|
|
37
|
+
Object form, made available under the License, as indicated by a
|
|
38
|
+
copyright notice that is included in or attached to the work
|
|
39
|
+
(an example is provided in the Appendix below).
|
|
40
|
+
|
|
41
|
+
"Derivative Works" shall mean any work, whether in Source or Object
|
|
42
|
+
form, that is based on (or derived from) the Work and for which the
|
|
43
|
+
editorial revisions, annotations, elaborations, or other modifications
|
|
44
|
+
represent, as a whole, an original work of authorship. For the purposes
|
|
45
|
+
of this License, Derivative Works shall not include works that remain
|
|
46
|
+
separable from, or merely link (or bind by name) to the interfaces of,
|
|
47
|
+
the Work and Derivative Works thereof.
|
|
48
|
+
|
|
49
|
+
"Contribution" shall mean any work of authorship, including
|
|
50
|
+
the original version of the Work and any modifications or additions
|
|
51
|
+
to that Work or Derivative Works thereof, that is intentionally
|
|
52
|
+
submitted to Licensor for inclusion in the Work by the copyright owner
|
|
53
|
+
or by an individual or Legal Entity authorized to submit on behalf of
|
|
54
|
+
the copyright owner. For the purposes of this definition, "submitted"
|
|
55
|
+
means any form of electronic, verbal, or written communication sent
|
|
56
|
+
to the Licensor or its representatives, including but not limited to
|
|
57
|
+
communication on electronic mailing lists, source code control systems,
|
|
58
|
+
and issue tracking systems that are managed by, or on behalf of, the
|
|
59
|
+
Licensor for the purpose of discussing and improving the Work, but
|
|
60
|
+
excluding communication that is conspicuously marked or otherwise
|
|
61
|
+
designated in writing by the copyright owner as "Not a Contribution."
|
|
62
|
+
|
|
63
|
+
"Contributor" shall mean Licensor and any individual or Legal Entity
|
|
64
|
+
on behalf of whom a Contribution has been received by Licensor and
|
|
65
|
+
subsequently incorporated within the Work.
|
|
66
|
+
|
|
67
|
+
2. Grant of Copyright License. Subject to the terms and conditions of
|
|
68
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
69
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
70
|
+
copyright license to reproduce, prepare Derivative Works of,
|
|
71
|
+
publicly display, publicly perform, sublicense, and distribute the
|
|
72
|
+
Work and such Derivative Works in Source or Object form.
|
|
73
|
+
|
|
74
|
+
3. Grant of Patent License. Subject to the terms and conditions of
|
|
75
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
76
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
77
|
+
(except as stated in this section) patent license to make, have made,
|
|
78
|
+
use, offer to sell, sell, import, and otherwise transfer the Work,
|
|
79
|
+
where such license applies only to those patent claims licensable
|
|
80
|
+
by such Contributor that are necessarily infringed by their
|
|
81
|
+
Contribution(s) alone or by combination of their Contribution(s)
|
|
82
|
+
with the Work to which such Contribution(s) was submitted. If You
|
|
83
|
+
institute patent litigation against any entity (including a
|
|
84
|
+
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
|
85
|
+
or a Contribution incorporated within the Work constitutes direct
|
|
86
|
+
or contributory patent infringement, then any patent licenses
|
|
87
|
+
granted to You under this License for that Work shall terminate
|
|
88
|
+
as of the date such litigation is filed.
|
|
89
|
+
|
|
90
|
+
4. Redistribution. You may reproduce and distribute copies of the
|
|
91
|
+
Work or Derivative Works thereof in any medium, with or without
|
|
92
|
+
modifications, and in Source or Object form, provided that You
|
|
93
|
+
meet the following conditions:
|
|
94
|
+
|
|
95
|
+
(a) You must give any other recipients of the Work or
|
|
96
|
+
Derivative Works a copy of this License; and
|
|
97
|
+
|
|
98
|
+
(b) You must cause any modified files to carry prominent notices
|
|
99
|
+
stating that You changed the files; and
|
|
100
|
+
|
|
101
|
+
(c) You must retain, in the Source form of any Derivative Works
|
|
102
|
+
that You distribute, all copyright, patent, trademark, and
|
|
103
|
+
attribution notices from the Source form of the Work,
|
|
104
|
+
excluding those notices that do not pertain to any part of
|
|
105
|
+
the Derivative Works; and
|
|
106
|
+
|
|
107
|
+
(d) If the Work includes a "NOTICE" text file as part of its
|
|
108
|
+
distribution, then any Derivative Works that You distribute must
|
|
109
|
+
include a readable copy of the attribution notices contained
|
|
110
|
+
within such NOTICE file, excluding those notices that do not
|
|
111
|
+
pertain to any part of the Derivative Works, in at least one
|
|
112
|
+
of the following places: within a NOTICE text file distributed
|
|
113
|
+
as part of the Derivative Works; within the Source form or
|
|
114
|
+
documentation, if provided along with the Derivative Works; or,
|
|
115
|
+
within a display generated by the Derivative Works, if and
|
|
116
|
+
wherever such third-party notices normally appear. The contents
|
|
117
|
+
of the NOTICE file are for informational purposes only and
|
|
118
|
+
do not modify the License. You may add Your own attribution
|
|
119
|
+
notices within Derivative Works that You distribute, alongside
|
|
120
|
+
or as an addendum to the NOTICE text from the Work, provided
|
|
121
|
+
that such additional attribution notices cannot be construed
|
|
122
|
+
as modifying the License.
|
|
123
|
+
|
|
124
|
+
You may add Your own copyright statement to Your modifications and
|
|
125
|
+
may provide additional or different license terms and conditions
|
|
126
|
+
for use, reproduction, or distribution of Your modifications, or
|
|
127
|
+
for any such Derivative Works as a whole, provided Your use,
|
|
128
|
+
reproduction, and distribution of the Work otherwise complies with
|
|
129
|
+
the conditions stated in this License.
|
|
130
|
+
|
|
131
|
+
5. Submission of Contributions. Unless You explicitly state otherwise,
|
|
132
|
+
any Contribution intentionally submitted for inclusion in the Work
|
|
133
|
+
by You to the Licensor shall be under the terms and conditions of
|
|
134
|
+
this License, without any additional terms or conditions.
|
|
135
|
+
Notwithstanding the above, nothing herein shall supersede or modify
|
|
136
|
+
the terms of any separate license agreement you may have executed
|
|
137
|
+
with Licensor regarding such Contributions.
|
|
138
|
+
|
|
139
|
+
6. Trademarks. This License does not grant permission to use the trade
|
|
140
|
+
names, trademarks, service marks, or product names of the Licensor,
|
|
141
|
+
except as required for reasonable and customary use in describing the
|
|
142
|
+
origin of the Work and reproducing the content of the NOTICE file.
|
|
143
|
+
|
|
144
|
+
7. Disclaimer of Warranty. Unless required by applicable law or
|
|
145
|
+
agreed to in writing, Licensor provides the Work (and each
|
|
146
|
+
Contributor provides its Contributions) on an "AS IS" BASIS,
|
|
147
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
|
148
|
+
implied, including, without limitation, any warranties or conditions
|
|
149
|
+
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
|
150
|
+
PARTICULAR PURPOSE. You are solely responsible for determining the
|
|
151
|
+
appropriateness of using or redistributing the Work and assume any
|
|
152
|
+
risks associated with Your exercise of permissions under this License.
|
|
153
|
+
|
|
154
|
+
8. Limitation of Liability. In no event and under no legal theory,
|
|
155
|
+
whether in tort (including negligence), contract, or otherwise,
|
|
156
|
+
unless required by applicable law (such as deliberate and grossly
|
|
157
|
+
negligent acts) or agreed to in writing, shall any Contributor be
|
|
158
|
+
liable to You for damages, including any direct, indirect, special,
|
|
159
|
+
incidental, or consequential damages of any character arising as a
|
|
160
|
+
result of this License or out of the use or inability to use the
|
|
161
|
+
Work (including but not limited to damages for loss of goodwill,
|
|
162
|
+
work stoppage, computer failure or malfunction, or any and all
|
|
163
|
+
other commercial damages or losses), even if such Contributor
|
|
164
|
+
has been advised of the possibility of such damages.
|
|
165
|
+
|
|
166
|
+
9. Accepting Warranty or Additional Liability. While redistributing
|
|
167
|
+
the Work or Derivative Works thereof, You may choose to offer,
|
|
168
|
+
and charge a fee for, acceptance of support, warranty, indemnity,
|
|
169
|
+
or other liability obligations and/or rights consistent with this
|
|
170
|
+
License. However, in accepting such obligations, You may act only
|
|
171
|
+
on Your own behalf and on Your sole responsibility, not on behalf
|
|
172
|
+
of any other Contributor, and only if You agree to indemnify,
|
|
173
|
+
defend, and hold each Contributor harmless for any liability
|
|
174
|
+
incurred by, or claims asserted against, such Contributor by reason
|
|
175
|
+
of your accepting any such warranty or additional liability.
|
|
176
|
+
|
|
177
|
+
END OF TERMS AND CONDITIONS
|
|
178
|
+
|
|
179
|
+
APPENDIX: How to apply the Apache License to your work.
|
|
180
|
+
|
|
181
|
+
To apply the Apache License to your work, attach the following
|
|
182
|
+
boilerplate notice, with the fields enclosed by brackets "[]"
|
|
183
|
+
replaced with your own identifying information. (Don't include
|
|
184
|
+
the brackets!) The text should be enclosed in the appropriate
|
|
185
|
+
comment syntax for the file format. We also recommend that a
|
|
186
|
+
file or class name and description of purpose be included on the
|
|
187
|
+
same "printed page" as the copyright notice for easier
|
|
188
|
+
identification within third-party archives.
|
|
189
|
+
|
|
190
|
+
Copyright [yyyy] [name of copyright owner]
|
|
191
|
+
|
|
192
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
|
193
|
+
you may not use this file except in compliance with the License.
|
|
194
|
+
You may obtain a copy of the License at
|
|
195
|
+
|
|
196
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
|
197
|
+
|
|
198
|
+
Unless required by applicable law or agreed to in writing, software
|
|
199
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
|
200
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
201
|
+
See the License for the specific language governing permissions and
|
|
202
|
+
limitations under the License.
|