id
stringlengths
7
14
text
stringlengths
1
106k
291570_28
protected AuthenticationInfo merge(AuthenticationInfo info, AuthenticationInfo aggregate) { if (aggregate != null && !isEmpty(aggregate.getPrincipals())) { return aggregate; } return info != null ? info : aggregate; }
291570_29
public AuthenticationInfo beforeAttempt(Realm realm, AuthenticationToken token, AuthenticationInfo aggregate) throws AuthenticationException { if (getStopAfterFirstSuccess() && aggregate != null && !isEmpty(aggregate.getPrincipals())) { throw new ShortCircuitIterationException(); } return aggregate;...
291570_30
public AuthenticationInfo beforeAttempt(Realm realm, AuthenticationToken token, AuthenticationInfo aggregate) throws AuthenticationException { if (getStopAfterFirstSuccess() && aggregate != null && !isEmpty(aggregate.getPrincipals())) { throw new ShortCircuitIterationException(); } return aggregate;...
291570_31
public AuthenticationInfo beforeAttempt(Realm realm, AuthenticationToken token, AuthenticationInfo aggregate) throws AuthenticationException { if (getStopAfterFirstSuccess() && aggregate != null && !isEmpty(aggregate.getPrincipals())) { throw new ShortCircuitIterationException(); } return aggregate;...
291570_32
public AuthenticationInfo beforeAttempt(Realm realm, AuthenticationToken token, AuthenticationInfo aggregate) throws AuthenticationException { if (getStopAfterFirstSuccess() && aggregate != null && !isEmpty(aggregate.getPrincipals())) { throw new ShortCircuitIterationException(); } return aggregate;...
291570_33
public void assertAuthorized(Annotation a) throws AuthorizationException { if (!(a instanceof RequiresPermissions)) return; RequiresPermissions rpAnnotation = (RequiresPermissions) a; String[] perms = getAnnotationValue(a); Subject subject = getSubject(); if (perms.length == 1) { subject.che...
291570_34
public void assertAuthorized(Annotation a) throws AuthorizationException { if (!(a instanceof RequiresPermissions)) return; RequiresPermissions rpAnnotation = (RequiresPermissions) a; String[] perms = getAnnotationValue(a); Subject subject = getSubject(); if (perms.length == 1) { subject.che...
291570_35
public void assertAuthorized(Annotation a) throws AuthorizationException { if (!(a instanceof RequiresRoles)) return; RequiresRoles rrAnnotation = (RequiresRoles) a; String[] roles = rrAnnotation.value(); if (roles.length == 1) { getSubject().checkRole(roles[0]); return; } if (Lo...
291570_36
public void assertAuthorized(Annotation a) throws AuthorizationException { if (!(a instanceof RequiresRoles)) return; RequiresRoles rrAnnotation = (RequiresRoles) a; String[] roles = rrAnnotation.value(); if (roles.length == 1) { getSubject().checkRole(roles[0]); return; } if (Lo...
291570_37
public void assertAuthorized(Annotation a) throws AuthorizationException { if (!(a instanceof RequiresRoles)) return; RequiresRoles rrAnnotation = (RequiresRoles) a; String[] roles = rrAnnotation.value(); if (roles.length == 1) { getSubject().checkRole(roles[0]); return; } if (Lo...
291570_38
public boolean implies(Permission p) { // By default only supports comparisons with other WildcardPermissions if (!(p instanceof WildcardPermission)) { return false; } WildcardPermission wp = (WildcardPermission) p; List<Set<String>> otherParts = wp.getParts(); int i = 0; for (Set<St...
291570_39
public boolean implies(Permission p) { // By default only supports comparisons with other WildcardPermissions if (!(p instanceof WildcardPermission)) { return false; } WildcardPermission wp = (WildcardPermission) p; List<Set<String>> otherParts = wp.getParts(); int i = 0; for (Set<St...
291570_40
public boolean equals(Object o) { if (o instanceof WildcardPermission) { WildcardPermission wp = (WildcardPermission) o; return parts.equals(wp.parts); } return false; }
291570_41
public boolean implies(Permission p) { // By default only supports comparisons with other WildcardPermissions if (!(p instanceof WildcardPermission)) { return false; } WildcardPermission wp = (WildcardPermission) p; List<Set<String>> otherParts = wp.getParts(); int i = 0; for (Set<St...
291570_42
public String toString() { StringBuilder buffer = new StringBuilder(); for (Set<String> part : parts) { if (buffer.length() > 0) { buffer.append(PART_DIVIDER_TOKEN); } Iterator<String> partIt = part.iterator(); while(partIt.hasNext()) { buffer.append(partI...
291570_43
public boolean implies(Permission p) { // By default only supports comparisons with other WildcardPermissions if (!(p instanceof WildcardPermission)) { return false; } WildcardPermission wp = (WildcardPermission) p; List<Set<String>> otherParts = wp.getParts(); int i = 0; for (Set<St...
291570_44
public boolean implies(Permission p) { return true; }
291570_45
public boolean implies(Permission p) { return true; }
291570_46
public void execute(Runnable command) { Runnable associated = associateWithSubject(command); getTargetExecutor().execute(associated); }
291570_47
public <T> Future<T> submit(Callable<T> task) { Callable<T> work = associateWithSubject(task); return this.targetExecutorService.submit(work); }
291570_48
public LdapContextFactory getContextFactory() { return this.contextFactory; }
291570_49
public void setUserDnTemplate(String template) throws IllegalArgumentException { if (!StringUtils.hasText(template)) { String msg = "User DN template cannot be null or empty."; throw new IllegalArgumentException(msg); } int index = template.indexOf(USERDN_SUBSTITUTION_TOKEN); if (index <...
291570_50
public void setUserDnTemplate(String template) throws IllegalArgumentException { if (!StringUtils.hasText(template)) { String msg = "User DN template cannot be null or empty."; throw new IllegalArgumentException(msg); } int index = template.indexOf(USERDN_SUBSTITUTION_TOKEN); if (index <...
291570_51
public void setUserDnTemplate(String template) throws IllegalArgumentException { if (!StringUtils.hasText(template)) { String msg = "User DN template cannot be null or empty."; throw new IllegalArgumentException(msg); } int index = template.indexOf(USERDN_SUBSTITUTION_TOKEN); if (index <...
291570_52
protected String getUserDn(String principal) throws IllegalArgumentException, IllegalStateException { if (!StringUtils.hasText(principal)) { throw new IllegalArgumentException("User principal cannot be null or empty for User DN construction."); } String prefix = getUserDnPrefix(); String suffix ...
291570_53
protected String getUserDn(String principal) throws IllegalArgumentException, IllegalStateException { if (!StringUtils.hasText(principal)) { throw new IllegalArgumentException("User principal cannot be null or empty for User DN construction."); } String prefix = getUserDnPrefix(); String suffix ...
291570_54
@Deprecated public LdapContext getLdapContext(String username, String password) throws NamingException { if (username != null && principalSuffix != null) { username += principalSuffix; } return getLdapContext((Object) username, password); }
291570_55
@Deprecated public LdapContext getLdapContext(String username, String password) throws NamingException { if (username != null && principalSuffix != null) { username += principalSuffix; } return getLdapContext((Object) username, password); }
291570_56
@Deprecated public LdapContext getLdapContext(String username, String password) throws NamingException { return getLdapContext((Object) username, password); }
291570_57
public String getContextFactoryClassName() { return (String) getEnvironmentProperty(Context.INITIAL_CONTEXT_FACTORY); }
291570_58
@Deprecated public LdapContext getLdapContext(String username, String password) throws NamingException { return getLdapContext((Object) username, password); }
291570_59
public LdapContext getSystemLdapContext() throws NamingException { return getLdapContext((Object)getSystemUsername(), getSystemPassword()); }
291570_60
public void setResourcePath(String resourcePath) { this.resourcePath = resourcePath; }
291570_61
public void setResourcePath(String resourcePath) { this.resourcePath = resourcePath; }
291570_62
protected void processRoleDefinitions() throws ParseException { String roleDefinitions = getRoleDefinitions(); if (roleDefinitions == null) { return; } Map<String, String> roleDefs = toMap(toLines(roleDefinitions)); processRoleDefinitions(roleDefs); }
291570_63
protected void processUserDefinitions() throws ParseException { String userDefinitions = getUserDefinitions(); if (userDefinitions == null) { return; } Map<String, String> userDefs = toMap(toLines(userDefinitions)); processUserDefinitions(userDefs); }
291570_64
public boolean hasRole(PrincipalCollection principal, String roleIdentifier) { AuthorizationInfo info = getAuthorizationInfo(principal); return hasRole(roleIdentifier, info); }
291570_65
public boolean hasRole(PrincipalCollection principal, String roleIdentifier) { AuthorizationInfo info = getAuthorizationInfo(principal); return hasRole(roleIdentifier, info); }
291570_66
public void setSaltStyle(SaltStyle saltStyle) { this.saltStyle = saltStyle; if (saltStyle == SaltStyle.COLUMN && authenticationQuery.equals(DEFAULT_AUTHENTICATION_QUERY)) { authenticationQuery = DEFAULT_SALTED_AUTHENTICATION_QUERY; } }
291570_67
public void setSaltStyle(SaltStyle saltStyle) { this.saltStyle = saltStyle; if (saltStyle == SaltStyle.COLUMN && authenticationQuery.equals(DEFAULT_AUTHENTICATION_QUERY)) { authenticationQuery = DEFAULT_SALTED_AUTHENTICATION_QUERY; } }
291570_68
public void setSaltStyle(SaltStyle saltStyle) { this.saltStyle = saltStyle; if (saltStyle == SaltStyle.COLUMN && authenticationQuery.equals(DEFAULT_AUTHENTICATION_QUERY)) { authenticationQuery = DEFAULT_SALTED_AUTHENTICATION_QUERY; } }
291570_69
public void setSaltStyle(SaltStyle saltStyle) { this.saltStyle = saltStyle; if (saltStyle == SaltStyle.COLUMN && authenticationQuery.equals(DEFAULT_AUTHENTICATION_QUERY)) { authenticationQuery = DEFAULT_SALTED_AUTHENTICATION_QUERY; } }
291570_70
public void setSaltStyle(SaltStyle saltStyle) { this.saltStyle = saltStyle; if (saltStyle == SaltStyle.COLUMN && authenticationQuery.equals(DEFAULT_AUTHENTICATION_QUERY)) { authenticationQuery = DEFAULT_SALTED_AUTHENTICATION_QUERY; } }
291570_71
public void setSaltStyle(SaltStyle saltStyle) { this.saltStyle = saltStyle; if (saltStyle == SaltStyle.COLUMN && authenticationQuery.equals(DEFAULT_AUTHENTICATION_QUERY)) { authenticationQuery = DEFAULT_SALTED_AUTHENTICATION_QUERY; } }
291570_72
public void setSaltStyle(SaltStyle saltStyle) { this.saltStyle = saltStyle; if (saltStyle == SaltStyle.COLUMN && authenticationQuery.equals(DEFAULT_AUTHENTICATION_QUERY)) { authenticationQuery = DEFAULT_SALTED_AUTHENTICATION_QUERY; } }
291570_73
public void setSaltStyle(SaltStyle saltStyle) { this.saltStyle = saltStyle; if (saltStyle == SaltStyle.COLUMN && authenticationQuery.equals(DEFAULT_AUTHENTICATION_QUERY)) { authenticationQuery = DEFAULT_SALTED_AUTHENTICATION_QUERY; } }
291570_74
public PrincipalCollection getRememberedPrincipals(SubjectContext subjectContext) { PrincipalCollection principals = null; byte[] bytes = null; try { bytes = getRememberedSerializedIdentity(subjectContext); //SHIRO-138 - only call convertBytesToPrincipals if bytes exist: if (bytes !=...
291570_75
public Subject login(Subject subject, AuthenticationToken token) throws AuthenticationException { AuthenticationInfo info; try { info = authenticate(token); } catch (AuthenticationException ae) { try { onFailedLogin(token, ae, subject); } catch (Exception e) { ...
291570_76
@Override protected boolean onPreHandle(ServletRequest request, ServletResponse response, Object mappedValue) { // Always return true since we allow access to anyone return true; }
291570_77
protected boolean onAccessDenied(ServletRequest request, ServletResponse response) throws IOException { Subject subject = getSubject(request, response); // If the subject isn't identified, redirect to login URL if (subject.getPrincipal() == null) { saveRequestAndRedirectToLogin(request, response); ...
291570_78
@Override protected void postHandle(ServletRequest request, ServletResponse response) { if (hsts.isEnabled()) { StringBuilder directives = new StringBuilder(64) .append("max-age=").append(hsts.getMaxAge()); if (hsts.isIncludeSubDomains()) { directives.append("; ...
291570_79
@Override protected boolean onAccessDenied(ServletRequest request, ServletResponse response, Object mappedValue) throws IOException { //just redirect to the specified port: int port = toPort(mappedValue); String scheme = getScheme(request.getScheme(), port); StringBuilder sb = new StringBuilder(); s...
291570_80
protected boolean isAccessAllowed(ServletRequest request, ServletResponse response, Object mappedValue) throws Exception { String remoteIp = getHostFromRequest(request); for (IpAddressMatcher matcher : deniedIpMatchers) { if (matcher.matches(remoteIp)) { return false; } } for...
291570_81
public String getName() { return name; }
291570_82
public FilterChain getChain(ServletRequest request, ServletResponse response, FilterChain originalChain) { FilterChainManager filterChainManager = getFilterChainManager(); if (!filterChainManager.hasChains()) { return null; } String requestURI = getPathWithinApplication(request); // in sprin...
291570_83
public FilterChain getChain(ServletRequest request, ServletResponse response, FilterChain originalChain) { FilterChainManager filterChainManager = getFilterChainManager(); if (!filterChainManager.hasChains()) { return null; } String requestURI = getPathWithinApplication(request); // in sprin...
291570_84
protected boolean pathsMatch(String path, ServletRequest request) { String requestURI = getPathWithinApplication(request); if (requestURI != null && !DEFAULT_PATH_SEPARATOR.equals(requestURI) && requestURI.endsWith(DEFAULT_PATH_SEPARATOR)) { requestURI = requestURI.substring(0, requestURI.le...
291570_85
protected boolean pathsMatch(String path, ServletRequest request) { String requestURI = getPathWithinApplication(request); if (requestURI != null && !DEFAULT_PATH_SEPARATOR.equals(requestURI) && requestURI.endsWith(DEFAULT_PATH_SEPARATOR)) { requestURI = requestURI.substring(0, requestURI.le...
291570_86
protected boolean pathsMatch(String path, ServletRequest request) { String requestURI = getPathWithinApplication(request); if (requestURI != null && !DEFAULT_PATH_SEPARATOR.equals(requestURI) && requestURI.endsWith(DEFAULT_PATH_SEPARATOR)) { requestURI = requestURI.substring(0, requestURI.le...
291570_87
protected boolean pathsMatch(String path, ServletRequest request) { String requestURI = getPathWithinApplication(request); if (requestURI != null && !DEFAULT_PATH_SEPARATOR.equals(requestURI) && requestURI.endsWith(DEFAULT_PATH_SEPARATOR)) { requestURI = requestURI.substring(0, requestURI.le...
291570_88
public HttpSession getSession(boolean create) { HttpSession httpSession; if (isHttpSessions()) { httpSession = super.getSession(false); if (httpSession == null && create) { //Shiro 1.2: assert that creation is enabled (SHIRO-266): if (WebUtils._isSessionCreationEnabled(th...
291570_89
public final void doFilter(ServletRequest request, ServletResponse response, FilterChain filterChain) throws ServletException, IOException { String alreadyFilteredAttributeName = getAlreadyFilteredAttributeName(); if ( request.getAttribute(alreadyFilteredAttributeName) != null ) { log.trace("Fil...
291570_90
@Deprecated public void setSessionMode(String sessionMode) { log.warn("The 'sessionMode' property has been deprecated. Please configure an appropriate WebSessionManager " + "instance instead of using this property. This property/method will be removed in a later version."); String mode = sessionMo...
291570_91
@SuppressWarnings({"UnusedDeclaration"}) public void setCookie(Cookie cookie) { this.cookie = cookie; }
291570_92
protected byte[] getRememberedSerializedIdentity(SubjectContext subjectContext) { if (!WebUtils.isHttp(subjectContext)) { if (log.isDebugEnabled()) { String msg = "SubjectContext argument is not an HTTP-aware instance. This is required to obtain a " + "servlet request and re...
291570_93
@SuppressWarnings({"UnusedDeclaration"}) public void setCookie(Cookie cookie) { this.cookie = cookie; }
291570_94
protected byte[] getRememberedSerializedIdentity(SubjectContext subjectContext) { if (!WebUtils.isHttp(subjectContext)) { if (log.isDebugEnabled()) { String msg = "SubjectContext argument is not an HTTP-aware instance. This is required to obtain a " + "servlet request and re...
291570_95
public void afterInjection(Destroyable injectee) { registry.add(injectee); }
291570_96
public <T> Provider<T> scope(final Key<T> key, final Provider<T> unscoped) { return new Provider<T>() { public T get() { Subject subject = ThreadContext.getSubject(); if (subject == null) { throw new OutOfScopeException("There is no Shiro Session currently in scope.")...
291570_97
public <T> Provider<T> scope(final Key<T> key, final Provider<T> unscoped) { return new Provider<T>() { public T get() { Subject subject = ThreadContext.getSubject(); if (subject == null) { throw new OutOfScopeException("There is no Shiro Session currently in scope.")...
291570_98
public SecurityManager getSecurityManager() { return securityManager; }
291570_99
protected final LinkedBindingBuilder<Realm> bindRealm() { Multibinder<Realm> multibinder = Multibinder.newSetBinder(binder(), Realm.class); return multibinder.addBinding(); }
2916790_0
@Override public void preprocessRdfData(InputStream[] datasets, MediaType rdfMimeType, MediaType fileMimeType, String absoluteBaseURI, LiteralHashing hashing) throws Exception { this.connection.setAutoCommit(false); createDatabase(); loadRDFData(datasets, rdfMimeType, absoluteBaseURI, fileMimeType, hashing); co...
2916790_1
@Override public ResultSetCursor getRDFTypes() throws Exception { if (typeIndex == -1) { typeIndex = getUriIndex(RDF.TYPE.toString()); } String sql = "SELECT DISTINCT object FROM relations WHERE (predicate = " + typeIndex + ")"; try { PreparedStatement pstmt = connection.prepareStatement(sql); ResultSet rs...
2916790_2
@Override public ResultSetCursor getRDFTypesForInstances(int[] subjects) throws Exception { if (typeIndex == -1) { typeIndex = getUriIndex(RDF.TYPE.toString()); } StringBuilder b = new StringBuilder(); for (int i : subjects) { b.append('('); b.append(i); b.append(')'); b.append(','); } String sql = "S...
2916790_3
@Override public ResultSetCursor getOutgoingRelations(int[] instances) throws Exception { final StringBuilder b = new StringBuilder(); for (int i : instances) { b.append('('); b.append(i); b.append(')'); b.append(','); } String sql = "SELECT relations.subject, relations.predicate, relations.object FROM re...
2916790_4
@Override public ResultSetCursor getIncomingRelations(int[] instances) throws Exception { StringBuilder b = new StringBuilder(); for (int i : instances) { b.append('('); b.append(i); b.append(')'); b.append(','); } String qs; if (instances.length == 0) { return null; } else { qs = b.substring(0, b.l...
2916790_5
@Override public ResultSetCursor dbSort(List<String> index, int maxLength) throws Exception { String prefix = "SELECT * FROM ( VALUES "; String suffix = " ) AS t(string) order by string"; StringBuilder b = new StringBuilder(); for (int i = 0; i < index.size(); i++) { b.append("(?)"); b.append(","); } String...
2916790_6
@Override public Reader serialize(Document document, KnowledgeBase kb) throws Exception { switch (document.getMimeType()) { case TEXT: return serializeTextPlain(document, kb, document.getContent()); case HTML: return serializeTextHtml(document, kb, document.getContent()); default: return serializeTextPlain(...
2916790_7
@Override public Reader serialize(Document document, KnowledgeBase kb) throws Exception { switch (document.getMimeType()) { case TEXT: return serializeTextPlain(document, kb, document.getContent()); case HTML: return serializeTextHtml(document, kb, document.getContent()); default: return serializeTextPlain(...
2916790_8
public Reader getGroundTruth(final URI uri) throws Exception { if (labelFileMediaType == MediaType.DIRECTORY) { return new StringReader(FileUtils.readFileToString(new File(uri))); } else if (labelFileMediaType == MediaType.ZIP) { ZipFile zipFile = new ZipFile(labelFolder); String[] entryName = uri.toURL().getFi...
2916790_9
public Reader getGroundTruth(final URI uri) throws Exception { if (labelFileMediaType == MediaType.DIRECTORY) { return new StringReader(FileUtils.readFileToString(new File(uri))); } else if (labelFileMediaType == MediaType.ZIP) { ZipFile zipFile = new ZipFile(labelFolder); String[] entryName = uri.toURL().getFi...
2928039_4
;
2928039_5
;
2928039_8
;
2928039_9
public static Evaluator getSqlEscapingEvaluator() { return new Evaluator() { public String evaluate(String expression, Context context) { List l = parseParams(expression, context.getVariableResolver()); if (l.size() != 1) { throw new DataImportHandlerException(SEVERE, "'escapeSql' must have at...
2930574_0
protected Path getDistCPInputFile(Map<Path, FileSystem> consumePaths, Path tmp) throws IOException { Path input = getInputPath(); if (!srcFs.exists(input)) return null; //find all consumePaths which need to be pulled FileStatus[] fileList = srcFs.listStatus(input); if (fi...
2930574_1
protected Path getDistCPInputFile(Map<Path, FileSystem> consumePaths, Path tmp) throws IOException { Path input = getInputPath(); if (!srcFs.exists(input)) return null; //find all consumePaths which need to be pulled FileStatus[] fileList = srcFs.listStatus(input); if (fi...
2930574_2
public List<Path> run(String [] args) throws Exception { List<Path> inconsistencydata = new ArrayList<Path>(); String [] localStreamrootDirs = args[0].split(","); String mergedStreamRoorDir = args[1]; List<String> streamNames = new ArrayList<String>(); if (args.length == 2) { FileSystem fs = new Path(mergedStre...
2930574_3
Map<Path, Path> populateTrashCommitPaths(Set<FileStatus> trashSet) { // find trash paths Map<Path, Path> trashPaths = new TreeMap<Path, Path>(); Path trash = cluster.getTrashPathWithDateHour(); Iterator<FileStatus> it = trashSet.iterator(); while (it.hasNext()) { FileStatus src = it.next(); Path targe...
2934254_0
public String resolveProps(@Nullable String s) { if (s == null) { return null; } int ipos = 0; int pos = s.indexOf("${", ipos); if (pos == -1) return s; StringBuilder sb = new StringBuilder(); while (ipos < s.length()) { pos = s.indexOf("${", ipos); if (pos < 0) { sb.append(s.substring(ipos)); brea...
2934254_1
public static List<ResultAttribute> values() { return Arrays.asList(TYPE_NAME, OBJ_DOMAIN, CLASS_NAME, ATTRIBUTE_NAME); }
2934254_2
public static ResultAttribute forName(@Nonnull String attributeName) { if (attributeName.startsWith(TypeNameProperty.PREFIX)) { return new TypeNameProperty(attributeName.substring(TypeNameProperty.PREFIX.length())); } String[] split = StringUtils.splitByCharacterTypeCamelCase(attributeName); StringBuilder sb = ne...
2934254_3
@Override public T create() { return outputWriter; }
2934254_4
public static String cleanupStr(String name) { return cleanupStr(name, false); }
2934254_5
public static String cleanupStr(String name) { return cleanupStr(name, false); }
2934254_6
public static String getKeyString(Server server, Query query, Result result, List<String> typeNames, String rootPrefix) { StringBuilder sb = new StringBuilder(); addRootPrefix(rootPrefix, sb); addAlias(server, sb); addSeparator(sb); addMBeanIdentifier(query, result, sb); addSeparator(sb); addTypeName(query, resu...
2934254_7
public static Map<String, String> extractMap(String typeNameStr) { if (typeNameStr == null) { return Collections.emptyMap(); } Map<String, String> result = newHashMap(); for (TypeNameValue typeNameValue : extract(typeNameStr)) { result.put(typeNameValue.getKey(), typeNameValue.getValue()); } return result; }
2934254_8
public String build(List<String> typeNames, String typeNameStr) { return doBuild(typeNames, typeNameStr); }
2934254_9
@Override public String build(List<String> typeNames, String typeNameStr) { List<String> resultingTypeNames = new ArrayList<>(prependedTypeNames); if (typeNames != null) { for (String name : typeNames) { if (!resultingTypeNames.contains(name)) { resultingTypeNames.add(name); } } } return doBuild(resul...