{"action":"created","comment":{"url":"https://api.github.com/repos/USGS-CIDA/cida-auth/pulls/comments/23625890","id":23625890,"diff_hunk":"@@ -0,0 +1,73 @@\n+package gov.usgs.cida.auth.service.authentication;\n+\n+import gov.usgs.cida.auth.model.User;\n+import gov.usgs.cida.config.DynamicReadOnlyProperties;\n+\n+import javax.naming.NamingException;\n+\n+import org.apache.commons.lang3.StringUtils;\n+import org.slf4j.Logger;\n+import org.slf4j.LoggerFactory;\n+\n+public class AlternativeService {\n+\n+\tprivate static final Logger LOG = LoggerFactory.getLogger(AlternativeService.class);\n+\n+\tprivate static final String JNDI_ALT_URL_PARAM_NAME = \"auth.alt.url\";\n+\n+\tprivate AlternativeService() {\n+\t\t// Utility class, should not be instantiated\n+\t}\n+\n+\tpublic static User authenticate(String username, char[] password) {\n+\t\tUser user = new User();\n+\t\tuser.setAuthenticated(false);\n+\t\t\n+\t\tDynamicReadOnlyProperties props = new DynamicReadOnlyProperties();\n+\t\ttry {\n+\t\t\tprops.addJNDIContexts();\n+\t\t} catch (NamingException ex) {\n+\t\t\tLOG.error(\"Error attempting to read JNDI properties.\", ex);\n+\t\t}\n+\t\t\n+\t\tString url = props.getProperty(JNDI_ALT_URL_PARAM_NAME);\n+\t\tif (StringUtils.isBlank(url)) {\n+\t\t\tLOG.error(\"Error authenticating against ALT. Check that JNDI parameters are configured.\");\n+\t\t} else {\n+\t\t\tuser = authenticate(username, password, url);\n+\t\t}\n+\n+\t\treturn user;\n+\t}\n+\n+\t/**\n+\t * Does the heavy lifting of authenticating\n+\t *\n+\t * @param username\n+\t * @param password\n+\t * @param jndiUrl\n+\t * @return\n+\t */\n+\tprivate static User authenticate(String username, char[] password, String jndiUrl) {","path":"auth-webservice/src/main/java/gov/usgs/cida/auth/service/authentication/AlternativeService.java","position":51,"original_position":51,"commit_id":"74f67ce100c69477e82e0a4b30a6e368d48483d6","original_commit_id":"74f67ce100c69477e82e0a4b30a6e368d48483d6","user":{"login":"thongsav-usgs","id":3835711,"avatar_url":"https://avatars.githubusercontent.com/u/3835711?v=3","gravatar_id":"","url":"https://api.github.com/users/thongsav-usgs","html_url":"https://github.com/thongsav-usgs","followers_url":"https://api.github.com/users/thongsav-usgs/followers","following_url":"https://api.github.com/users/thongsav-usgs/following{/other_user}","gists_url":"https://api.github.com/users/thongsav-usgs/gists{/gist_id}","starred_url":"https://api.github.com/users/thongsav-usgs/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/thongsav-usgs/subscriptions","organizations_url":"https://api.github.com/users/thongsav-usgs/orgs","repos_url":"https://api.github.com/users/thongsav-usgs/repos","events_url":"https://api.github.com/users/thongsav-usgs/events{/privacy}","received_events_url":"https://api.github.com/users/thongsav-usgs/received_events","type":"User","site_admin":false},"body":"Related to above, consider having jndiUrl set by constructor and consolidating the two authenticate methods into a single one.","created_at":"2015-01-27T17:34:10Z","updated_at":"2015-01-27T17:34:10Z","html_url":"https://github.com/USGS-CIDA/cida-auth/pull/42#discussion_r23625890","pull_request_url":"https://api.github.com/repos/USGS-CIDA/cida-auth/pulls/42","_links":{"self":{"href":"https://api.github.com/repos/USGS-CIDA/cida-auth/pulls/comments/23625890"},"html":{"href":"https://github.com/USGS-CIDA/cida-auth/pull/42#discussion_r23625890"},"pull_request":{"href":"https://api.github.com/repos/USGS-CIDA/cida-auth/pulls/42"}}},"pull_request":{"url":"https://api.github.com/repos/USGS-CIDA/cida-auth/pulls/42","id":28127230,"html_url":"https://github.com/USGS-CIDA/cida-auth/pull/42","diff_url":"https://github.com/USGS-CIDA/cida-auth/pull/42.diff","patch_url":"https://github.com/USGS-CIDA/cida-auth/pull/42.patch","issue_url":"https://api.github.com/repos/USGS-CIDA/cida-auth/issues/42","number":42,"state":"open","locked":false,"title":"new, alternative authentication service POC implementation","user":{"login":"instantsoup","id":6976939,"avatar_url":"https://avatars.githubusercontent.com/u/6976939?v=3","gravatar_id":"","url":"https://api.github.com/users/instantsoup","html_url":"https://github.com/instantsoup","followers_url":"https://api.github.com/users/instantsoup/followers","following_url":"https://api.github.com/users/instantsoup/following{/other_user}","gists_url":"https://api.github.com/users/instantsoup/gists{/gist_id}","starred_url":"https://api.github.com/users/instantsoup/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/instantsoup/subscriptions","organizations_url":"https://api.github.com/users/instantsoup/orgs","repos_url":"https://api.github.com/users/instantsoup/repos","events_url":"https://api.github.com/users/instantsoup/events{/privacy}","received_events_url":"https://api.github.com/users/instantsoup/received_events","type":"User","site_admin":false},"body":"","created_at":"2015-01-27T17:23:32Z","updated_at":"2015-01-27T17:34:10Z","closed_at":null,"merged_at":null,"merge_commit_sha":"258dd4349ef9b8ef25b6cdd9e7a43b6b51f73267","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/USGS-CIDA/cida-auth/pulls/42/commits","review_comments_url":"https://api.github.com/repos/USGS-CIDA/cida-auth/pulls/42/comments","review_comment_url":"https://api.github.com/repos/USGS-CIDA/cida-auth/pulls/comments/{number}","comments_url":"https://api.github.com/repos/USGS-CIDA/cida-auth/issues/42/comments","statuses_url":"https://api.github.com/repos/USGS-CIDA/cida-auth/statuses/74f67ce100c69477e82e0a4b30a6e368d48483d6","head":{"label":"instantsoup:master","ref":"master","sha":"74f67ce100c69477e82e0a4b30a6e368d48483d6","user":{"login":"instantsoup","id":6976939,"avatar_url":"https://avatars.githubusercontent.com/u/6976939?v=3","gravatar_id":"","url":"https://api.github.com/users/instantsoup","html_url":"https://github.com/instantsoup","followers_url":"https://api.github.com/users/instantsoup/followers","following_url":"https://api.github.com/users/instantsoup/following{/other_user}","gists_url":"https://api.github.com/users/instantsoup/gists{/gist_id}","starred_url":"https://api.github.com/users/instantsoup/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/instantsoup/subscriptions","organizations_url":"https://api.github.com/users/instantsoup/orgs","repos_url":"https://api.github.com/users/instantsoup/repos","events_url":"https://api.github.com/users/instantsoup/events{/privacy}","received_events_url":"https://api.github.com/users/instantsoup/received_events","type":"User","site_admin":false},"repo":{"id":29690120,"name":"cida-auth","full_name":"instantsoup/cida-auth","owner":{"login":"instantsoup","id":6976939,"avatar_url":"https://avatars.githubusercontent.com/u/6976939?v=3","gravatar_id":"","url":"https://api.github.com/users/instantsoup","html_url":"https://github.com/instantsoup","followers_url":"https://api.github.com/users/instantsoup/followers","following_url":"https://api.github.com/users/instantsoup/following{/other_user}","gists_url":"https://api.github.com/users/instantsoup/gists{/gist_id}","starred_url":"https://api.github.com/users/instantsoup/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/instantsoup/subscriptions","organizations_url":"https://api.github.com/users/instantsoup/orgs","repos_url":"https://api.github.com/users/instantsoup/repos","events_url":"https://api.github.com/users/instantsoup/events{/privacy}","received_events_url":"https://api.github.com/users/instantsoup/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/instantsoup/cida-auth","description":"A collection of modules dealing with authentication and authorization","fork":true,"url":"https://api.github.com/repos/instantsoup/cida-auth","forks_url":"https://api.github.com/repos/instantsoup/cida-auth/forks","keys_url":"https://api.github.com/repos/instantsoup/cida-auth/keys{/key_id}","collaborators_url":"https://api.github.com/repos/instantsoup/cida-auth/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/instantsoup/cida-auth/teams","hooks_url":"https://api.github.com/repos/instantsoup/cida-auth/hooks","issue_events_url":"https://api.github.com/repos/instantsoup/cida-auth/issues/events{/number}","events_url":"https://api.github.com/repos/instantsoup/cida-auth/events","assignees_url":"https://api.github.com/repos/instantsoup/cida-auth/assignees{/user}","branches_url":"https://api.github.com/repos/instantsoup/cida-auth/branches{/branch}","tags_url":"https://api.github.com/repos/instantsoup/cida-auth/tags","blobs_url":"https://api.github.com/repos/instantsoup/cida-auth/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/instantsoup/cida-auth/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/instantsoup/cida-auth/git/refs{/sha}","trees_url":"https://api.github.com/repos/instantsoup/cida-auth/git/trees{/sha}","statuses_url":"https://api.github.com/repos/instantsoup/cida-auth/statuses/{sha}","languages_url":"https://api.github.com/repos/instantsoup/cida-auth/languages","stargazers_url":"https://api.github.com/repos/instantsoup/cida-auth/stargazers","contributors_url":"https://api.github.com/repos/instantsoup/cida-auth/contributors","subscribers_url":"https://api.github.com/repos/instantsoup/cida-auth/subscribers","subscription_url":"https://api.github.com/repos/instantsoup/cida-auth/subscription","commits_url":"https://api.github.com/repos/instantsoup/cida-auth/commits{/sha}","git_commits_url":"https://api.github.com/repos/instantsoup/cida-auth/git/commits{/sha}","comments_url":"https://api.github.com/repos/instantsoup/cida-auth/comments{/number}","issue_comment_url":"https://api.github.com/repos/instantsoup/cida-auth/issues/comments/{number}","contents_url":"https://api.github.com/repos/instantsoup/cida-auth/contents/{+path}","compare_url":"https://api.github.com/repos/instantsoup/cida-auth/compare/{base}...{head}","merges_url":"https://api.github.com/repos/instantsoup/cida-auth/merges","archive_url":"https://api.github.com/repos/instantsoup/cida-auth/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/instantsoup/cida-auth/downloads","issues_url":"https://api.github.com/repos/instantsoup/cida-auth/issues{/number}","pulls_url":"https://api.github.com/repos/instantsoup/cida-auth/pulls{/number}","milestones_url":"https://api.github.com/repos/instantsoup/cida-auth/milestones{/number}","notifications_url":"https://api.github.com/repos/instantsoup/cida-auth/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/instantsoup/cida-auth/labels{/name}","releases_url":"https://api.github.com/repos/instantsoup/cida-auth/releases{/id}","created_at":"2015-01-22T17:14:15Z","updated_at":"2015-01-27T17:14:14Z","pushed_at":"2015-01-27T17:14:14Z","git_url":"git://github.com/instantsoup/cida-auth.git","ssh_url":"git@github.com:instantsoup/cida-auth.git","clone_url":"https://github.com/instantsoup/cida-auth.git","svn_url":"https://github.com/instantsoup/cida-auth","homepage":"","size":534,"stargazers_count":0,"watchers_count":0,"language":"Java","has_issues":false,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":0,"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"USGS-CIDA:master","ref":"master","sha":"8f61555b47ef85dea9b94caab3a6e9cd004add86","user":{"login":"USGS-CIDA","id":918179,"avatar_url":"https://avatars.githubusercontent.com/u/918179?v=3","gravatar_id":"","url":"https://api.github.com/users/USGS-CIDA","html_url":"https://github.com/USGS-CIDA","followers_url":"https://api.github.com/users/USGS-CIDA/followers","following_url":"https://api.github.com/users/USGS-CIDA/following{/other_user}","gists_url":"https://api.github.com/users/USGS-CIDA/gists{/gist_id}","starred_url":"https://api.github.com/users/USGS-CIDA/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/USGS-CIDA/subscriptions","organizations_url":"https://api.github.com/users/USGS-CIDA/orgs","repos_url":"https://api.github.com/users/USGS-CIDA/repos","events_url":"https://api.github.com/users/USGS-CIDA/events{/privacy}","received_events_url":"https://api.github.com/users/USGS-CIDA/received_events","type":"Organization","site_admin":false},"repo":{"id":23077505,"name":"cida-auth","full_name":"USGS-CIDA/cida-auth","owner":{"login":"USGS-CIDA","id":918179,"avatar_url":"https://avatars.githubusercontent.com/u/918179?v=3","gravatar_id":"","url":"https://api.github.com/users/USGS-CIDA","html_url":"https://github.com/USGS-CIDA","followers_url":"https://api.github.com/users/USGS-CIDA/followers","following_url":"https://api.github.com/users/USGS-CIDA/following{/other_user}","gists_url":"https://api.github.com/users/USGS-CIDA/gists{/gist_id}","starred_url":"https://api.github.com/users/USGS-CIDA/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/USGS-CIDA/subscriptions","organizations_url":"https://api.github.com/users/USGS-CIDA/orgs","repos_url":"https://api.github.com/users/USGS-CIDA/repos","events_url":"https://api.github.com/users/USGS-CIDA/events{/privacy}","received_events_url":"https://api.github.com/users/USGS-CIDA/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/USGS-CIDA/cida-auth","description":"A collection of modules dealing with authentication and authorization","fork":false,"url":"https://api.github.com/repos/USGS-CIDA/cida-auth","forks_url":"https://api.github.com/repos/USGS-CIDA/cida-auth/forks","keys_url":"https://api.github.com/repos/USGS-CIDA/cida-auth/keys{/key_id}","collaborators_url":"https://api.github.com/repos/USGS-CIDA/cida-auth/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/USGS-CIDA/cida-auth/teams","hooks_url":"https://api.github.com/repos/USGS-CIDA/cida-auth/hooks","issue_events_url":"https://api.github.com/repos/USGS-CIDA/cida-auth/issues/events{/number}","events_url":"https://api.github.com/repos/USGS-CIDA/cida-auth/events","assignees_url":"https://api.github.com/repos/USGS-CIDA/cida-auth/assignees{/user}","branches_url":"https://api.github.com/repos/USGS-CIDA/cida-auth/branches{/branch}","tags_url":"https://api.github.com/repos/USGS-CIDA/cida-auth/tags","blobs_url":"https://api.github.com/repos/USGS-CIDA/cida-auth/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/USGS-CIDA/cida-auth/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/USGS-CIDA/cida-auth/git/refs{/sha}","trees_url":"https://api.github.com/repos/USGS-CIDA/cida-auth/git/trees{/sha}","statuses_url":"https://api.github.com/repos/USGS-CIDA/cida-auth/statuses/{sha}","languages_url":"https://api.github.com/repos/USGS-CIDA/cida-auth/languages","stargazers_url":"https://api.github.com/repos/USGS-CIDA/cida-auth/stargazers","contributors_url":"https://api.github.com/repos/USGS-CIDA/cida-auth/contributors","subscribers_url":"https://api.github.com/repos/USGS-CIDA/cida-auth/subscribers","subscription_url":"https://api.github.com/repos/USGS-CIDA/cida-auth/subscription","commits_url":"https://api.github.com/repos/USGS-CIDA/cida-auth/commits{/sha}","git_commits_url":"https://api.github.com/repos/USGS-CIDA/cida-auth/git/commits{/sha}","comments_url":"https://api.github.com/repos/USGS-CIDA/cida-auth/comments{/number}","issue_comment_url":"https://api.github.com/repos/USGS-CIDA/cida-auth/issues/comments/{number}","contents_url":"https://api.github.com/repos/USGS-CIDA/cida-auth/contents/{+path}","compare_url":"https://api.github.com/repos/USGS-CIDA/cida-auth/compare/{base}...{head}","merges_url":"https://api.github.com/repos/USGS-CIDA/cida-auth/merges","archive_url":"https://api.github.com/repos/USGS-CIDA/cida-auth/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/USGS-CIDA/cida-auth/downloads","issues_url":"https://api.github.com/repos/USGS-CIDA/cida-auth/issues{/number}","pulls_url":"https://api.github.com/repos/USGS-CIDA/cida-auth/pulls{/number}","milestones_url":"https://api.github.com/repos/USGS-CIDA/cida-auth/milestones{/number}","notifications_url":"https://api.github.com/repos/USGS-CIDA/cida-auth/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/USGS-CIDA/cida-auth/labels{/name}","releases_url":"https://api.github.com/repos/USGS-CIDA/cida-auth/releases{/id}","created_at":"2014-08-18T16:01:18Z","updated_at":"2015-01-20T20:59:59Z","pushed_at":"2015-01-20T20:59:59Z","git_url":"git://github.com/USGS-CIDA/cida-auth.git","ssh_url":"git@github.com:USGS-CIDA/cida-auth.git","clone_url":"https://github.com/USGS-CIDA/cida-auth.git","svn_url":"https://github.com/USGS-CIDA/cida-auth","homepage":"","size":534,"stargazers_count":0,"watchers_count":0,"language":"Java","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":5,"mirror_url":null,"open_issues_count":1,"forks":5,"open_issues":1,"watchers":0,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/USGS-CIDA/cida-auth/pulls/42"},"html":{"href":"https://github.com/USGS-CIDA/cida-auth/pull/42"},"issue":{"href":"https://api.github.com/repos/USGS-CIDA/cida-auth/issues/42"},"comments":{"href":"https://api.github.com/repos/USGS-CIDA/cida-auth/issues/42/comments"},"review_comments":{"href":"https://api.github.com/repos/USGS-CIDA/cida-auth/pulls/42/comments"},"review_comment":{"href":"https://api.github.com/repos/USGS-CIDA/cida-auth/pulls/comments/{number}"},"commits":{"href":"https://api.github.com/repos/USGS-CIDA/cida-auth/pulls/42/commits"},"statuses":{"href":"https://api.github.com/repos/USGS-CIDA/cida-auth/statuses/74f67ce100c69477e82e0a4b30a6e368d48483d6"}}}}