Prevent unnecessary debug log message creation
Closes gh-8001
This commit is contained in:
		
							parent
							
								
									75438ff1a9
								
							
						
					
					
						commit
						bd6ae47d68
					
				| 
						 | 
					@ -1,5 +1,5 @@
 | 
				
			||||||
/*
 | 
					/*
 | 
				
			||||||
 * Copyright 2012-2016 the original author or authors.
 | 
					 * Copyright 2012-2017 the original author or authors.
 | 
				
			||||||
 *
 | 
					 *
 | 
				
			||||||
 * Licensed under the Apache License, Version 2.0 (the "License");
 | 
					 * Licensed under the Apache License, Version 2.0 (the "License");
 | 
				
			||||||
 * you may not use this file except in compliance with the License.
 | 
					 * you may not use this file except in compliance with the License.
 | 
				
			||||||
| 
						 | 
					@ -87,7 +87,9 @@ public class UserInfoTokenServices implements ResourceServerTokenServices {
 | 
				
			||||||
			throws AuthenticationException, InvalidTokenException {
 | 
								throws AuthenticationException, InvalidTokenException {
 | 
				
			||||||
		Map<String, Object> map = getMap(this.userInfoEndpointUrl, accessToken);
 | 
							Map<String, Object> map = getMap(this.userInfoEndpointUrl, accessToken);
 | 
				
			||||||
		if (map.containsKey("error")) {
 | 
							if (map.containsKey("error")) {
 | 
				
			||||||
 | 
								if (this.logger.isDebugEnabled()) {
 | 
				
			||||||
				this.logger.debug("userinfo returned error: " + map.get("error"));
 | 
									this.logger.debug("userinfo returned error: " + map.get("error"));
 | 
				
			||||||
 | 
								}
 | 
				
			||||||
			throw new InvalidTokenException(accessToken);
 | 
								throw new InvalidTokenException(accessToken);
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
		return extractAuthentication(map);
 | 
							return extractAuthentication(map);
 | 
				
			||||||
| 
						 | 
					@ -123,7 +125,9 @@ public class UserInfoTokenServices implements ResourceServerTokenServices {
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	@SuppressWarnings({ "unchecked" })
 | 
						@SuppressWarnings({ "unchecked" })
 | 
				
			||||||
	private Map<String, Object> getMap(String path, String accessToken) {
 | 
						private Map<String, Object> getMap(String path, String accessToken) {
 | 
				
			||||||
 | 
							if (this.logger.isDebugEnabled()) {
 | 
				
			||||||
			this.logger.debug("Getting user info from: " + path);
 | 
								this.logger.debug("Getting user info from: " + path);
 | 
				
			||||||
 | 
							}
 | 
				
			||||||
		try {
 | 
							try {
 | 
				
			||||||
			OAuth2RestOperations restTemplate = this.restTemplate;
 | 
								OAuth2RestOperations restTemplate = this.restTemplate;
 | 
				
			||||||
			if (restTemplate == null) {
 | 
								if (restTemplate == null) {
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
		Reference in New Issue