Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

documentation for Auth? #502

Open
dvhassel opened this issue Apr 30, 2020 · 2 comments
Open

documentation for Auth? #502

dvhassel opened this issue Apr 30, 2020 · 2 comments

Comments

@dvhassel
Copy link
Contributor

Hi,

is there any documentation floating around on using IIIF Auth with Loris? I'm trying to get this working with the SimpleFSResolver, without any luck so far unfortunately.

I have created the rules.json file for my test image (test1.jp2 and test1.rules.json live in the same directory) and added use_auth_rules=True to the [resolver] section of loris2.conf.

This is being picked up as I can see in the log:
[DEBUG]: resolver.use_auth_rules=True

However, test1.jp2/info.json does include the extraInfo from test1.rules.json. It doesn't seem to be a caching issue.

Any suggestions?

@bcail
Copy link
Contributor

bcail commented Apr 30, 2020

@dvhassel have you set up the authorizer section of your loris2.conf? This is an example config from webapp.py:
config['authorizer'] = {
"impl": "loris.authorizer.RulesAuthorizer",
"cookie_secret": b"4rakTQJDyhaYgoew802q78pNnsXR7ClvbYtAF1YC87o",
"token_secret": b"hyQijpEEe9z1OB9NOkHvmSA4lC1B4lu1n80bKNx0Uz0=",
"roles_key": "roles",
"id_key": "sub",
}

@dvhassel
Copy link
Contributor Author

dvhassel commented Apr 30, 2020

hi, no I didn't. I have this now in loris2.conf:

[authorizer]
impl = 'loris.authorizer.RulesAuthorizer'
cookie_secret = b'4rakTQJDyhaYgoew802q78pNnsXR7ClvbYtAF1YC87o'
token_secret = b'hyQijpEEe9z1OB9NOkHvmSA4lC1B4lu1n80bKNx0Uz0='
roles_key = 'roles'
id_key = 'sub'

The rules.json:

{
	"extraInfo": 
	{
	    "service" : {
	  	"@context": "http://iiif.io/api/auth/1/context.json",
	   	"@id": "http://<ip-to-loris>/clickthrough",
	    	"profile": "http://iiif.io/api/auth/1/clickthrough",
	    	"label": "Terms of Use for Example Institution",
    		"header": "Restricted Material with Terms of Use",
    		"description": "<span>... terms of use ... </span>",
    		"confirmLabel": "I Agree",
    		"failureHeader": "Terms of Use Not Accepted",
 		"failureDescription": "You must accept the terms of use to see the content.",
		 "service": [
				{
					"@context": "http://iiif.io/api/auth/1/context.json", 
					"@id": "http://<ip-to-loris>/token",
					"profile": "http://iiif.io/api/auth/1/token"
				}
			]
	    }
	}
}

in the log I can see this now:
(loris.authorizer) [DEBUG]: Called is_protected with {'extraInfo': {'service (...)

but nothing in /info.json.

Step-by-step I guess?

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

No branches or pull requests

2 participants