[
https://issues.apache.org/jira/browse/DERBY-3200?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
Kim Haase updated DERBY-3200:
-----------------------------
Attachment: sqlauthclientshutdown.txt
sqlauthclient.txt
sqlauthembedded.txt
I figured out most of the weird results -- sorry for the noise. (The database
was not where I thought it was and must have been a leftover from a previous
run after all.) The old authentication/authorization examples work fine.
I changed the SQL authorization programs so that the default connection mode
for the network client example is fullAccess (the default), so that the GRANT
statement can restrict privileges.
The embedded example works as expected: see the attached file
sqlauthembedded.txt.
But I am still getting an error on the GRANT statement in the SQL authorization
client example:
s.execute("GRANT SELECT, INSERT ON accessibletbl TO sqlsam");
System.out.println("Granted select/insert privileges to sqlsam");
This is what happens:
---SQLException Caught---
SQLState: 42Z60
Severity: -1
Message: GRANT not allowed unless database property
derby.database.sqlAuthorization has value 'TRUE'.
java.sql.SQLSyntaxErrorException: GRANT not allowed unless database property
derby.database.sqlAuthorization has value 'TRUE'.
at
org.apache.derby.client.am.SQLExceptionFactory40.getSQLException(Unknown Source)
The program goes on to allow sqlsam to do everything he wants, because he has
the default fullAccess privilege. See the attached file sqlauthclient.txt.
I tried stopping and restarting the network server between the first and second
client programs, but that caused worse things to happen. See the attached file
sqlauthclientshutdown.txt.
I am using different jar files to invoke the programs: derby.jar for the
embedded program, and derbyclient.jar for the client programs. Could that make
any difference?
I'll attach updated versions of the programs in addition to the program output
files.
> Developer's Guide: Add examples showing use of SQL authorization with user
> authentication
> -----------------------------------------------------------------------------------------
>
> Key: DERBY-3200
> URL: https://issues.apache.org/jira/browse/DERBY-3200
> Project: Derby
> Issue Type: Improvement
> Components: Documentation
> Reporter: Kim Haase
> Assignee: Kim Haase
> Priority: Minor
> Attachments: auth2.log, AuthExampleClientSQLAuth1.java,
> AuthExampleClientSQLAuth2.java, AuthExampleEmbeddedSQLAuth.java,
> rdevcsecuresqlauthembeddedex.dita, sqlauthclient.txt,
> sqlauthclientshutdown.txt, sqlauthembedded.txt
>
>
> This is the followup to DERBY-1823 that Francois Orsini suggested.
> I've been experimenting and reading the Developer's Guide section on SQL
> authorization (User authorizations, cdevcsecure36595).
> It appears that the only use of SQL authorization mode is to restrict user
> access, not to expand it.
> For example, if you set the default connection mode to noAccess, a user with
> fullAccess can't grant any privileges to a user with noAccess. And presumably
> if the default connection mode is readOnlyAccess, a user with fullAccess
> can't grant any privileges beyond SELECT, which the user has anyway.
> Only if the default connection mode is fullAccess is SQL authorization mode
> meaningful. That means that a fullAccess user can use GRANT to restrict
> another user's privileges on a particular database that the user owns.
> I'm running into a problem at the end, though. At the beginning of the
> program, as nobody in particular, I was able to create several users, some of
> them with full access. But at the end of the program, it seems that even a
> user with full access isn't allowed to turn off those database properties:
> Message: User 'MARY' does not have execute permission on PROCEDURE
> 'SYSCS_UTIL'.'SYSCS_SET_DATABASE_PROPERTY'.
> This seems a bit extreme. I know that with SQL authorization on, "the ability
> to read from or write to database objects is further restricted to the owner
> of the database objects." But the ability to execute built-in system
> procedures? Can I log in as SYSCS_UTIL? How?
> I realize that having access to SYSCS_SET_DATABASE_PROPERTY would allow me to
> in effect delete myself -- but that's essentially what I do at the end of the
> program that sets derby.connection.requireAuthentication but not
> derby.database.sqlAuthorization.
> The documentation does say that once you have turned on SQL authorization,
> you can't turn it off. But it doesn't say that you can't turn anything else
> off, either!
> I'll attach the program I've been using. Most of the stacktraces are
> expected, but I'm stumped by that last one.
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.