Skip to content

add an example of basic user user and group logic#3799

Draft
OyvindLGjesdal wants to merge 1 commit intoapache:mainfrom
OyvindLGjesdal:shiro
Draft

add an example of basic user user and group logic#3799
OyvindLGjesdal wants to merge 1 commit intoapache:mainfrom
OyvindLGjesdal:shiro

Conversation

@OyvindLGjesdal
Copy link
Contributor

@OyvindLGjesdal OyvindLGjesdal commented Mar 15, 2026

GitHub issue resolved #

Pull request Description:

Adds tests that shows that current configuration stanzas allows other authenticated users access to configured paths, for demonstration. Also adds a second test that tries the same using groups, which works.

How should the ini files look instead if examples and default (with commented example that has this behaviour) look?

Not for merging currently, but for demonstration.

The existing test access_userPassword already has a shiro where there are two users and paths are different, so the test can be changed there, by adding an assertion that expects user1 to not have ping access

https://github.com/apache/jena/blob/main/jena-fuseki2/jena-fuseki-main/testing/Shiro/shiro_userpassword.ini

# Licensed under the terms of http://www.apache.org/licenses/LICENSE-2.0

[main]
plainMatcher=org.apache.shiro.authc.credential.SimpleCredentialsMatcher

[users]
admin=pw

[roles]

[users]
admin=pw
user1=passwd1

[urls]
/$/ping = authcBasic,user[admin]
/ds = authcBasic,user[user1]
/**=anon

  • Tests are included.
  • Documentation change and updates are provided for the Apache Jena website
  • Commits have been squashed to remove intermediate development commit messages.
  • Key commit messages start with the issue number (GH-xxxx)

By submitting this pull request, I acknowledge that I am making a contribution to the Apache Software Foundation under the terms and conditions of the Contributor's Agreement.


See the Apache Jena "Contributing" guide.

attemptByLocalhost(server, httpClient, dsname);
// and a SPARQL query
QueryExecHTTP.service(URL).httpClient(httpClient).query("ASK{}").ask();
QueryExecHTTP.service(URL).httpClient(httpClient).query("ASK{}");
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Without the .ask(), this line becomes a no-op - so it doesn't look right.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks, fixed. Also noticed an additional error (that the test that I expected to fail passed, so I had messed up the expect value).

@OyvindLGjesdal
Copy link
Contributor Author

OyvindLGjesdal commented Mar 16, 2026

Sorry for the messy I PR, I see that it is kind of verbose and a wip with commented sections, but thought it was usable as a demonstration for the docs update. I think at least it fails correctly now e.g


org.opentest4j.AssertionFailedError: user1 user should not be able to ping: 2026-03-16T07:41:38.190+00:00
 ==> 
Expected :false
Actual   :true
<Click to see difference>
	at org.junit.jupiter.api.AssertionFailureBuilder.build(AssertionFailureBuilder.java:158)
	at org.junit.jupiter.api.AssertionFailureBuilder.buildAndThrow(AssertionFailureBuilder.java:139)
	at org.junit.jupiter.api.AssertFalse.failNotFalse(AssertFalse.java:69)
	at org.junit.jupiter.api.AssertFalse.assertFalse(AssertFalse.java:41)
	at org.junit.jupiter.api.Assertions.assertFalse(Assertions.java:255)
	at org.apache.jena.fuseki.mod.shiro.TestModShiro.access_userPassword(TestModShiro.java:190)

* add failing test for demo purpose
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants