public static String getUniqueId ( String accessId , String realm ) { if ( realm != null ) { Pattern pattern = Pattern . compile ( "([^:]+):(" + Pattern . quote ( realm ) + ")/(.*)" ) ; Matcher m = pattern . matcher ( accessId ) ; if ( m . matches ( ) ) { if ( m . group ( 3 ) . length ( ) > 0 ) { return m . group ( 3 ) ; } } } // if there is no match, fall back. return getUniqueId ( accessId ) ; }
Given an accessId and realm name extract the uniqueId .