Produced by Araxis Merge on 6/18/2018 3:37:04 PM Eastern Daylight Time. See www.araxis.com for information about Merge. This report uses XHTML and CSS2, and is best viewed with a modern standards-compliant browser. For optimum results when printing this report, use landscape orientation and enable printing of background images and colours in your browser.
| # | Location | File | Last Modified |
|---|---|---|---|
| 1 | CTT_DM2_v7.zip\VUID-rest\src\main\java\gov\vha\vuid\rest\session | PrismeIntegratedUserService.java | Tue Jun 12 16:41:56 2018 UTC |
| 2 | CTT_DM2_v7.zip\VUID-rest\src\main\java\gov\vha\vuid\rest\session | PrismeIntegratedUserService.java | Tue Jun 12 21:09:56 2018 UTC |
| Description | Between Files 1 and 2 |
|
|---|---|---|
| Text Blocks | Lines | |
| Unchanged | 3 | 198 |
| Changed | 2 | 4 |
| Inserted | 0 | 0 |
| Removed | 0 | 0 |
| Whitespace | |
|---|---|
| Character case | Differences in character case are significant |
| Line endings | Differences in line endings (CR and LF characters) are ignored |
| CR/LF characters | Not shown in the comparison detail |
No regular expressions were active.
| 1 | /** | |
| 2 | * Copyrig ht Notice | |
| 3 | * | |
| 4 | * This is a work of the U.S. Government and is no t subject to copyrig ht | |
| 5 | * protect ion in the United St ates. Fore ign copyri ghts may a pply. | |
| 6 | * | |
| 7 | * License d under th e Apache L icense, Ve rsion 2.0 (the "Lice nse"); | |
| 8 | * you may not use t his file e xcept in c ompliance with the L icense. | |
| 9 | * You may obtain a copy of th e License at | |
| 10 | * | |
| 11 | * http:// www.apache .org/licen ses/LICENS E-2.0 | |
| 12 | * | |
| 13 | * Unless required b y applicab le law or agreed to in writing , software | |
| 14 | * distrib uted under the Licen se is dist ributed on an "AS IS " BASIS, | |
| 15 | * WITHOUT WARRANTIE S OR CONDI TIONS OF A NY KIND, e ither expr ess or imp lied. | |
| 16 | * See the License f or the spe cific lang uage gover ning permi ssions and | |
| 17 | * limitat ions under the Licen se. | |
| 18 | */ | |
| 19 | package go v.vha.vuid .rest.sess ion; | |
| 20 | ||
| 21 | import jav a.io.IOExc eption; | |
| 22 | import jav a.net.URL; | |
| 23 | import jav a.util.Opt ional; | |
| 24 | import jav a.util.Set ; | |
| 25 | import jav a.util.UUI D; | |
| 26 | import jav ax.inject. Singleton; | |
| 27 | import org .apache.lo gging.log4 j.LogManag er; | |
| 28 | import org .apache.lo gging.log4 j.Logger; | |
| 29 | import org .glassfish .hk2.api.R ank; | |
| 30 | import org .jvnet.hk2 .annotatio ns.Service ; | |
| 31 | import com .fasterxml .jackson.c ore.JsonPa rseExcepti on; | |
| 32 | import com .fasterxml .jackson.d atabind.Js onMappingE xception; | |
| 33 | import gov .vha.isaac .ochre.api .User; | |
| 34 | import gov .vha.isaac .ochre.api .PrismeRol e; | |
| 35 | ||
| 36 | /** | |
| 37 | * The Cla ss PrismeI ntegratedU serService | |
| 38 | * | |
| 39 | * {@link PrismeInte gratedUser Service} | |
| 40 | * | |
| 41 | * @author <a href=" mailto:joe l.kniaz.li st@gmail.c om">Joel K niaz</a> | |
| 42 | */ | |
| 43 | @Service(n ame="rest- prismeUser Service") | |
| 44 | @Rank(valu e = 10) | |
| 45 | @Singleton | |
| 46 | public cla ss PrismeI ntegratedU serService implement s PrismeUs erService { | |
| 47 | pr ivate stat ic Logger log = LogM anager.get Logger(Pri smeIntegra tedUserSer vice.class ); | |
| 48 | ||
| 49 | // private Pr operties p rismePrope rties_ = n ull; | |
| 50 | ||
| 51 | pr otected Pr ismeIntegr atedUserSe rvice() { | |
| 52 | //fo r HK2 | |
| 53 | } | |
| 54 | ||
| 55 | /* * | |
| 56 | * | |
| 57 | * @see gov. vha.vuid.r est.sessio n.PrismeUs erService# getUser(ja va.lang.St ring) | |
| 58 | * / | |
| 59 | @O verride | |
| 60 | pu blic Optio nal<User> getUser(St ring ssoTo ken) { | |
| 61 | try { | |
| 62 | return Optional. of(getUser FromPrisme (ssoToken) ); | |
| 63 | } ca tch (Excep tion e) { | |
| 64 | log.er ror("Faile d to retre ive user f rom prisme ", e); | |
| 65 | return Optional. empty(); | |
| 66 | } | |
| 67 | } | |
| 68 | ||
| 69 | /* * | |
| 70 | * @see gov. vha.isaac. ochre.api. UserRoleSe rvice#getU serRoles(j ava.util.U UID) | |
| 71 | * / | |
| 72 | @O verride | |
| 73 | pu blic User getUser(UU ID userId) | |
| 74 | { | |
| 75 | thro w new Unsu pportedOpe rationExce ption(); | |
| 76 | } | |
| 77 | ||
| 78 | // Private h elpers | |
| 79 | pr otected Us er getUser FromPrisme (String ss oToken) th rows JsonP arseExcept ion, JsonM appingExce ption, IOE xception { | |
| 80 | // /* | |
| 81 | // * E xample URL for get_r oles_by_to ken | |
| 82 | // * URL url = new URL( "https:// DNS /rails_pri sme/roles/ get_roles_ by_token.j son?token= " + token) ; | |
| 83 | // */ | |
| 84 | // //St ring json = "{\"role s\":[{\"id \":10000,\ "name\":\" read_only\ ",\"resour ce_id\":nu ll,\"resou rce_type\" :null,\"cr eated_at\" :\ | |
| 85 | //"2016-09 -13T14:48: 18.000Z\", \"updated_ at\":\"201 6-09-13T14 :48:18.000 Z\"}],\"to ken_parsed ?\":true,\ "user\":\" DN S ArmbrD\",\ "type\":\" ssoi\",\"i d\":10005} "; | |
| 86 | Stri ng prismeR olesByToke nUrlStr = PrismeServ iceUtils.g etConfigPr operty("pr isme_roles _by_token_ url"); | |
| 87 | URL url = new URL(prisme RolesByTok enUrlStr); | |
| 88 | User user = Us erServiceU tils.getUs erFromUrl( url, ssoTo ken); | |
| 89 | log. trace("Ret rieved fro m " + pris meRolesByT okenUrlStr + " user= \"" + user + "\""); | |
| 90 | retu rn user; | |
| 91 | } | |
| 92 | ||
| 93 | /* * | |
| 94 | * @see gov. vha.isaac. ochre.api. UserRoleSe rvice#getA llUserRole s() | |
| 95 | * / | |
| 96 | @O verride | |
| 97 | pu blic Set<P rismeRole> getAllPos sibleUserR oles() | |
| 98 | { | |
| 99 | thro w new Unsu pportedOpe rationExce ption(); | |
| 100 | } | |
| 101 | } |
Araxis Merge (but not the data content of this report) is Copyright © 1993-2016 Araxis Ltd (www.araxis.com). All rights reserved.