changeset 21647:cbecd2e16979

auth: Make tokeninfo optional It is not supported by all OAuth2 solutions
author Aki Tuomi <aki.tuomi@dovecot.fi>
date Tue, 21 Feb 2017 11:21:19 +0200
parents 7f927c405b2f
children 66802cc05f4d
files src/auth/db-oauth2.c
diffstat 1 files changed, 7 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/src/auth/db-oauth2.c	Tue Feb 21 11:18:37 2017 +0200
+++ b/src/auth/db-oauth2.c	Tue Feb 21 11:21:19 2017 +0200
@@ -588,7 +588,12 @@
 	input.real_remote_port = req->auth_request->real_remote_port;
 	input.service = req->auth_request->service;
 
-	req->req = oauth2_token_validation_start(&db->oauth2_set, &input,
-						 db_oauth2_lookup_continue, req);
+	if (*db->oauth2_set.tokeninfo_url == '\0') {
+		req->req = oauth2_introspection_start(&req->db->oauth2_set, &input,
+						      db_oauth2_introspect_continue, req);
+	} else {
+		req->req = oauth2_token_validation_start(&db->oauth2_set, &input,
+							 db_oauth2_lookup_continue, req);
+	}
 	DLLIST_PREPEND(&db->head, req);
 }