private boolean isAuthorized ( BasicToken token , List < UriTemplate > matchedTemplates , String method ) { StringBuilder path = new StringBuilder ( ) ; // Merge all path templates and generate a path. for ( UriTemplate template : matchedTemplates ) { path . insert ( 0 , template . getTemplate ( ) ) ; } path . append ( ":" ) . append ( method ) ; //Look at user permissions to see if the service is permitted. return token . getPermissions ( ) . contains ( path . toString ( ) ) ; }
Merges all path patterns and and creates a single string value which will be equal with service methods path annotation value and HTTP method type . Generated string will be used for permission checks .