security-tactics-models / audit_accountability_codebert_v1 /best_validation_predictions.csv
desertsyao's picture
Upload folder using huggingface_hub
6f80ef7 verified
Raw History Blame Contribute Delete
67.4 kB
dataset_index,text,true_label,predicted_label,correct,error_type,probability_audit_accountability,probability_unrelated
0,@Override public void setApplicationEventPublisher(ApplicationEventPublisher applicationEventPublisher) { this.applicationEventPublisher = applicationEventPublisher; },unrelated,unrelated,True,,0.0007789436494931579,0.9992210865020752
1,"fileType.addPattern( pattern ); saveConfiguration( configuration ); triggerAuditEvent( """", """", AuditEvent.ADD_PATTERN, auditInformation ); }",audit_accountability,audit_accountability,True,,0.9966797828674316,0.0033202306367456913
2,private static SimpleDateFormat createNameFormat() { SimpleDateFormat fmt = new SimpleDateFormat( AuditEvent.TIMESTAMP_FORMAT ); fmt.setTimeZone( UTC_TIME_ZONE ); return fmt; },unrelated,unrelated,True,,0.0006577104213647544,0.9993422627449036
3,"triggerAuditEvent( repository.getRepository( ).getId( ), reference.toKey(), AuditEvent.PURGE_ARTIFACT );",audit_accountability,audit_accountability,True,,0.9966200590133667,0.0033799808006733656
4,"List<AuditEvent> events = new ArrayList<>(records.size()); for (AuditRecord record : records) { AuditEvent auditEvent = (AuditEvent) metadataRepository.getMetadataFacet(session, record.repositoryId, AuditEvent.FACET_ID, record.name); events.add(auditEvent); } return events;",audit_accountability,audit_accountability,True,,0.99665367603302,0.00334633095189929
5,"protected void triggerAuditEvent( String repositoryId, String resource, String action, AuditInformation auditInformation ) { User user = auditInformation == null ? null : auditInformation.getUser(); AuditEvent event = new AuditEvent( repositoryId, user == null ? ""null"" : user.getUsername(), resource, action ); event.setRemoteIP( auditInformation == null ? ""null"" : auditInformation.getRemoteAddr() ); for ( AuditListener listener : getAuditListeners() ) { listener.auditEvent( event ); } }",audit_accountability,audit_accountability,True,,0.9966598749160767,0.0033401641994714737
6,"fileType.removePattern( pattern ); saveConfiguration( configuration ); triggerAuditEvent( """", """", AuditEvent.REMOVE_PATTERN, auditInformation ); }",audit_accountability,audit_accountability,True,,0.9966797828674316,0.00332023692317307
7,protected final Logger logger = LoggerFactory.getLogger( getClass() );,unrelated,unrelated,True,,0.00066304428037256,0.9993368983268738
8,"@Override public AuditEvent createMetadataFacet( String repositoryId, String name ) { return new AuditEvent( name, repositoryId ); }",audit_accountability,audit_accountability,True,,0.9966243505477905,0.003375662723556161
9,"triggerAuditEvent( repositoryGroupId, null, AuditEvent.DELETE_REPO_GROUP, auditInformation ); return Boolean.TRUE; }",audit_accountability,audit_accountability,True,,0.9966455101966858,0.003354499116539955
10,"protected void triggerAuditEvent( String repositoryId, String filePath, String action ) { AuditEvent auditEvent = new AuditEvent( repositoryId, getPrincipal(), filePath, action ); AuditInformation auditInformation = getAuditInformation(); auditEvent.setUserId( auditInformation.getUser() == null ? """" : auditInformation.getUser().getUsername() ); auditEvent.setRemoteIP( auditInformation.getRemoteAddr() ); for ( AuditListener auditListener : getAuditListeners() ) { auditListener.auditEvent( auditEvent ); } }",audit_accountability,audit_accountability,True,,0.9966625571250916,0.003337371628731489
11,"@Override public void auditEvent( AuditEvent event ) { StringBuilder msg = new StringBuilder(); msg.append( checkNull( event.getRepositoryId() ) ).append( DELIM ); msg.append( event.getUserId() ).append( DELIM ); msg.append( checkNull( event.getRemoteIP() ) ).append( DELIM ); msg.append( '\""' ).append( checkNull( event.getResource() ) ).append( '\""' ).append( DELIM ); msg.append( '\""' ).append( event.getAction() ).append( '\""' ); logger.info( msg.toString() ); }",audit_accountability,audit_accountability,True,,0.9963418841362,0.003658141242340207
12,"public AuditEvent( String repoId, String user, String resource, String action ) { this.repositoryId = repoId; this.userId = user; this.resource = resource; this.action = action; this.timestamp = Calendar.getInstance().getTime(); }",audit_accountability,audit_accountability,True,,0.9958723187446594,0.004127639811486006
13,"Configuration configuration = getArchivaConfiguration().getConfiguration(); NetworkProxyConfiguration networkProxyConfiguration = getNetworkProxyConfiguration( networkProxy ); configuration.removeNetworkProxy( networkProxyConfiguration ); configuration.addNetworkProxy( networkProxyConfiguration ); triggerAuditEvent( networkProxy.getId(), null, AuditEvent.MODIFY_NETWORK_PROXY, auditInformation ); saveConfiguration( configuration );",audit_accountability,audit_accountability,True,,0.9966685175895691,0.003331440268084407
14,"configuration.getRepositoryScanning().addKnownContentConsumer( knownContentConsumer ); saveConfiguration( configuration ); triggerAuditEvent( """", """", AuditEvent.ENABLE_REPO_CONSUMER, auditInformation ); }",audit_accountability,audit_accountability,True,,0.9966576099395752,0.0033424273133277893
15,"Commit(CommitMetadata commitMetadata, List<CdoSnapshot> snapshots, Diff diff) { Validate.argumentsAreNotNull(commitMetadata, snapshots, diff); this.commitMetadata = commitMetadata; this.snapshots = snapshots; this.diff = diff; }",audit_accountability,unrelated,False,true_audit_accountability_predicted_unrelated,0.0008665707428008318,0.9991334080696106
16,"public Mono<Object> markAudited(Object object) { Assert.notNull(object, ""Source object must not be null""); if (!isAuditable(object)) { return Mono.just(object); } PersistentEntity<?, ? extends PersistentProperty<?>> entity = entities .getRequiredPersistentEntity(object.getClass()); return entity.isNew(object) ? markCreated(object) : markModified(object); }",audit_accountability,unrelated,False,true_audit_accountability_predicted_unrelated,0.05436493828892708,0.9456350803375244
17,JaversAuditableAspectAsync(JaversCommitAdvice javersCommitAdvice) { this.javersCommitAdvice = javersCommitAdvice; },unrelated,audit_accountability,False,true_unrelated_predicted_audit_accountability,0.8558459877967834,0.14415398240089417
18,"public CommitMetadata(String author, Map<String, String> properties, LocalDateTime commitDate, Instant commitDateInstant, CommitId id) { Validate.argumentsAreNotNull(author, properties, commitDate, id); this.author = author; this.properties = new HashMap<>(properties); this.commitDate = commitDate; this.id = id; this.commitDateInstant = initCommitDateInstant(commitDate, commitDateInstant); }",audit_accountability,unrelated,False,true_audit_accountability_predicted_unrelated,0.015962179750204086,0.9840378761291504
19,<T> Optional<AuditableBeanWrapper<T>> getBeanWrapperFor(T source);,audit_accountability,unrelated,False,true_audit_accountability_predicted_unrelated,0.0007884991355240345,0.9992114305496216
20,"public JaversAuditableAspect(Javers javers, AuthorProvider authorProvider) { this(javers, authorProvider, new EmptyPropertiesProvider()); }",audit_accountability,audit_accountability,True,,0.9915635585784912,0.0084364153444767
21,"<T> T markCreated(Auditor<?> auditor, T source) { Assert.notNull(source, ""Source entity must not be null""); return touch(auditor, source, true); }",audit_accountability,audit_accountability,True,,0.9863481521606445,0.013651832938194275
22,"public boolean isAuditable() { return Optionals.isAnyPresent(createdByField, createdDateField, lastModifiedByField, lastModifiedDateField); }",audit_accountability,unrelated,False,true_audit_accountability_predicted_unrelated,0.0009130316320806742,0.9990869760513306
23,"public JaversAuditableAspectAsync(Javers javers, AuthorProvider authorProvider, CommitPropertiesProvider commitPropertiesProvider,Executor executor) { this(new JaversCommitAdvice(javers, authorProvider, commitPropertiesProvider, executor)); }",audit_accountability,audit_accountability,True,,0.9964648485183716,0.0035351859405636787
24,"public static AuditingHandler from(MappingContext<?, ?> mappingContext) { return new AuditingHandler(PersistentEntities.of(mappingContext)); }",audit_accountability,unrelated,False,true_audit_accountability_predicted_unrelated,0.0007030780543573201,0.9992969036102295
25,"public JaversAuditableAspect(Javers javers, AuthorProvider authorProvider, CommitPropertiesProvider commitPropertiesProvider) { this(new JaversCommitAdvice(javers, authorProvider, commitPropertiesProvider) ); }",audit_accountability,audit_accountability,True,,0.996487021446228,0.0035130290780216455
26,CommitEntry(CommitMetadata commitMetadata) { this.commitMetadata = commitMetadata; },unrelated,unrelated,True,,0.0008890447206795216,0.999110996723175
27,private static final Log logger = LogFactory.getLog(AuditingHandler.class);,unrelated,unrelated,True,,0.000662136182654649,0.9993378520011902
28,JaversAuditableAspect(JaversCommitAdvice javersCommitAdvice) { this.javersCommitAdvice = javersCommitAdvice; },unrelated,audit_accountability,False,true_unrelated_predicted_audit_accountability,0.5178748965263367,0.48212510347366333
29,"package org.javers.core.metamodel.annotation; import org.javers.repository.api.JaversRepository; import java.lang.annotation.Retention; import java.lang.annotation.Target; import static java.lang.annotation.ElementType.FIELD; import static java.lang.annotation.ElementType.METHOD; import static java.lang.annotation.RetentionPolicy.RUNTIME; @Target ({FIELD, METHOD}) @Retention (RUNTIME) public @interface PropertyName { String value(); }",unrelated,unrelated,True,,0.0007101108785718679,0.999289870262146
30,"protected final boolean isAuditable(Object source) { Assert.notNull(source, ""Source entity must not be null""); return factory.getBeanWrapperFor(source).isPresent(); }",audit_accountability,unrelated,False,true_audit_accountability_predicted_unrelated,0.0010555449407547712,0.9989444613456726
31,final CommitMetadata context;,unrelated,unrelated,True,,0.0009308463195338845,0.9990691542625427
32,"private <T> T touch(Auditor<?> auditor, T target, boolean isNew) { Optional<AuditableBeanWrapper<T>> wrapper = factory.getBeanWrapperFor(target); return wrapper.map(it -> { touchAuditor(auditor, it, isNew); Optional<TemporalAccessor> now = dateTimeForNow ? touchDate(it, isNew) : Optional.empty();",audit_accountability,unrelated,False,true_audit_accountability_predicted_unrelated,0.0007417748565785587,0.9992582201957703
33,"public <T> T markModified(T source) { Assert.notNull(source, ""Entity must not be null""); return markModified(getAuditor(), source); }",audit_accountability,unrelated,False,true_audit_accountability_predicted_unrelated,0.0036575798876583576,0.9963423609733582
34,"public JaversExtendedRepository(JaversRepository delegate, SnapshotDiffer snapshotDiffer) { this.delegate = delegate; this.snapshotDiffer = snapshotDiffer; previousSnapshotsCalculator = new PreviousSnapshotsCalculator(input -> getSnapshots(input)); }",unrelated,unrelated,True,,0.0008415053016506135,0.999158501625061
35,"private Commit createCommit(String author, Map<String, String> properties, LiveGraph currentGraph){ CommitMetadata commitMetadata = newCommitMetadata(author, properties); ObjectGraph<CdoSnapshot> latestSnapshotGraph = snapshotGraphFactory.loadLatestAndCreateGraph(currentGraph.globalIds()); List<CdoSnapshot> changedCdoSnapshots = changedCdoSnapshotsFactory.create(currentGraph, latestSnapshotGraph.cdos(), commitMetadata); Diff diff = diffFactory.create(latestSnapshotGraph, currentGraph, Optional.of(commitMetadata)); return new Commit(commitMetadata, changedCdoSnapshots, diff); }",audit_accountability,audit_accountability,True,,0.9930773973464966,0.006922603119164705
36,"Class<?> entityClass = it.getClass(); return entities.mapOnContext(entityClass, (context, entity) -> { MappingAuditingMetadata metadata = getMetadata(context, entityClass); if (metadata.isAuditable()) { return Optional.<AuditableBeanWrapper<T>> of(new MappingMetadataAuditableBeanWrapper<>(getConversionService(), entity.getPropertyPathAccessor(it), metadata)); } return Optional.<AuditableBeanWrapper<T>> empty(); }).orElseGet(() -> super.getBeanWrapperFor(source));",audit_accountability,audit_accountability,True,,0.847515344619751,0.15248462557792664
37,"public JaversCommitAdvice(Javers javers, AuthorProvider authorProvider, CommitPropertiesProvider commitPropertiesProvider, Executor executor) { this.javers = javers; this.authorProvider = authorProvider; this.commitPropertiesProvider = commitPropertiesProvider; this.executor = executor; }",unrelated,unrelated,True,,0.0007432321435771883,0.9992567896842957
38,"public <T> T markCreated(T source) { Assert.notNull(source, ""Entity must not be null""); return markCreated(getAuditor(), source); }",audit_accountability,audit_accountability,True,,0.9891228079795837,0.010877253487706184
39,public boolean isAuditable() { return isAuditable.get(); },unrelated,unrelated,True,,0.0007373530534096062,0.9992626309394836
40,"public Object markAudited(Object object) { Assert.notNull(object, ""Source object must not be null""); if (!isAuditable(object)) { return object; } PersistentEntity<?, ? extends PersistentProperty<?>> entity = entities .getRequiredPersistentEntity(object.getClass()); return entity.isNew(object) ? markCreated(object) : markModified(object); }",audit_accountability,unrelated,False,true_audit_accountability_predicted_unrelated,0.19444452226161957,0.805555522441864
41,"public AuditingHandler(PersistentEntities entities) { super(entities); Assert.notNull(entities, ""PersistentEntities must not be null""); this.auditorAware = Optional.empty(); }",audit_accountability,audit_accountability,True,,0.9963005781173706,0.0036993727553635836
42,public void setAuditorAware(@Nullable AuditorAware<?> auditorAware) { this.auditorAware = Optional.ofNullable(auditorAware); },unrelated,unrelated,True,,0.0007099257200025022,0.9992899894714355
43,public boolean isAuditableAspectEnabled() { return auditableAspectEnabled; },unrelated,unrelated,True,,0.0007424452342092991,0.999257504940033
44,public void setAuditableAspectEnabled(boolean auditableAspectEnabled) { this.auditableAspectEnabled = auditableAspectEnabled; },unrelated,unrelated,True,,0.0008373292512260377,0.9991626739501953
45,@Override protected Class<?> getBeanClass(Element element) { return AuditingHandler.class; },unrelated,unrelated,True,,0.0007634436478838325,0.9992365837097168
46,public void setAuditorAware(@Nullable ReactiveAuditorAware<?> auditorAware) { this.auditorAware = auditorAware == null ? Mono::empty : auditorAware; },unrelated,unrelated,True,,0.0006986649823375046,0.9993013143539429
47,package org.javers.spring.annotation; import org.javers.core.Javers; import org.javers.spring.auditable.aspect.JaversAuditableAspect; import java.lang.annotation.ElementType; import java.lang.annotation.Retention; import java.lang.annotation.RetentionPolicy; import java.lang.annotation.Target; @Retention(RetentionPolicy.RUNTIME) @Target({ElementType.METHOD}) public @interface JaversAuditableConditionalDelete { },unrelated,unrelated,True,,0.0006820448325015604,0.99931800365448
48,"protected void notifyFailure(AuthenticationToken token, AuthenticationException ae) { for (AuthenticationListener listener : this.listeners) { listener.onFailure(token, ae); } }",audit_accountability,audit_accountability,True,,0.9963380098342896,0.00366196152754128
49,"@Override public void written(ServerSession session, String remoteHandle, FileHandle localHandle, long offset, byte[] data, int dataOffset, int dataLen, Throwable thrown) { this.applicationEventPublisher.publishEvent(new FileWrittenEvent(session, remoteHandle, localHandle.getFile(), dataLen, thrown)); }",unrelated,audit_accountability,False,true_unrelated_predicted_audit_accountability,0.9599892497062683,0.040010739117860794
50,"@Override public void created(ServerSession session, Path path, Map<String, ?> attrs, Throwable thrown) { this.applicationEventPublisher.publishEvent(new DirectoryCreatedEvent(session, path, attrs)); }",unrelated,audit_accountability,False,true_unrelated_predicted_audit_accountability,0.9818547964096069,0.018145255744457245
51,"protected void publish(String message) { FileTailingEvent event = new FileTailingEvent(this, message, getFile()); this.eventPublisher.publishEvent(event); }",unrelated,audit_accountability,False,true_unrelated_predicted_audit_accountability,0.9962246417999268,0.003775383345782757
52,"try { notifyFailure(token, ae); } catch (Throwable t2) { if (LOGGER.isWarnEnabled()) { String msg = ""Unable to send notification for failed authentication attempt - listener error?. "" + ""Please check your AuthenticationListener implementation(s). Logging sending exception "" + ""and propagating original AuthenticationException instead...""; LOGGER.warn(msg, t2); } }",audit_accountability,audit_accountability,True,,0.9965822100639343,0.0034178541973233223
53,"@Override public void removed(ServerSession session, Path path, boolean isDirectory, Throwable thrown) { this.applicationEventPublisher.publishEvent(new PathRemovedEvent(session, path, isDirectory, thrown)); }",unrelated,audit_accountability,False,true_unrelated_predicted_audit_accountability,0.9935405850410461,0.006459440104663372
54,"protected void notifySuccess(AuthenticationToken token, AuthenticationInfo info) { for (AuthenticationListener listener : this.listeners) { listener.onSuccess(token, info); } }",audit_accountability,audit_accountability,True,,0.9964622855186462,0.0035377820022404194
55,"@SuppressWarnings({""UnusedDeclaration""}) public Collection<AuthenticationListener> getAuthenticationListeners() { return this.listeners; }",unrelated,unrelated,True,,0.0006963033229112625,0.9993036985397339
56,private Collection<AuthenticationListener> listeners;,unrelated,unrelated,True,,0.0007809622911736369,0.9992190599441528
57,"@SuppressWarnings(""NullAway.Init"") private ApplicationEventPublisher eventPublisher;",unrelated,unrelated,True,,0.0007344287005253136,0.9992656111717224
58,public AbstractAuthenticator() { listeners = new ArrayList<AuthenticationListener>(); },unrelated,unrelated,True,,0.11549683660268784,0.884503185749054
59,"@SuppressWarnings({""UnusedDeclaration""}) public void setAuthenticationListeners(Collection<AuthenticationListener> listeners) { if (listeners == null) { this.listeners = new ArrayList<AuthenticationListener>(); } else { this.listeners = listeners; } }",unrelated,unrelated,True,,0.0007135950727388263,0.9992864727973938
60,protected void notifyLogout(PrincipalCollection principals) { for (AuthenticationListener listener : this.listeners) { listener.onLogout(principals); } },audit_accountability,audit_accountability,True,,0.9965522289276123,0.003447748487815261
61,"private void simulateFailedLogin(AuthenticationToken token) { try { AuthenticationInfo simulated = ensureSimulatedAuthenticationInfo(); if (simulated != null && assertCredentialsMatchWithoutException(token, simulated)) { String msg = ""Submitted credentials for token ["" + token + ""] matched the simulated credentials. "" + ""This indicates a misconfiguration of the realm's "" + ""CredentialsMatcher or simulated credentials. Please review your configuration.""; throw new IncorrectCredentialsException(msg); } } catch (AuthenticationException authenticationException) { LOGGER.error( ""CredentialsMatcher [{}] threw exception on method 'doCredentialsMatch'"", getCredentialsMatcher(), authenticationException); } }",unrelated,audit_accountability,False,true_unrelated_predicted_audit_accountability,0.9965315461158752,0.003468502778559923
62,protected void informCancelled( PeerReadRequest request ) { for (int i=0;i<listeners.size();i++){ try{ ((ExternalSeedReaderListener)listeners.get(i)).requestCancelled( request ); }catch( Throwable e ){ e.printStackTrace(); } } },unrelated,audit_accountability,False,true_unrelated_predicted_audit_accountability,0.9961208701133728,0.0038790665566921234
63,"private void checkAuthority(final String userName, final String srcRepositoryId, final String dstRepositoryId ) throws ArchivaRestServiceException { User user; try { user = securitySystem.getUserManager().findUser( userName ); } catch ( UserNotFoundException e ) { httpServletResponse.setHeader( ""WWW-Authenticate"", ""Bearer realm=\""archiva\"""" ); throw new ArchivaRestServiceException( ErrorMessage.of( ErrorKeys.USER_NOT_FOUND, userName ), 401 ); } catch ( UserManagerException e ) { throw new ArchivaRestServiceException( ErrorMessage.of( ErrorKeys.USER_MANAGER_ERROR, e.getMessage( ) ) ); } AuthenticationResult authn = new AuthenticationResult( true, userName, null ); SecuritySession securitySession = new DefaultSecuritySession( authn, user ); try { boolean authz = securitySystem.isAuthorized( securitySession, OPERATION_READ_REPOSITORY, srcRepositoryId ); if ( !authz ) { throw new ArchivaRestServiceException(ErrorMessage.of( ErrorKeys.PERMISSION_REPOSITORY_DENIED, srcRepositoryId, OPERATION_READ_REPOSITORY ), 403); } } catch ( AuthorizationException e ) { log.error( ""Error reading permission: {}"", e.getMessage(), e ); throw new ArchivaRestServiceException( ErrorMessage.of( ErrorKeys.AUTHORIZATION_ERROR, e.getMessage() ), 403); } try { boolean authz = securitySystem.isAuthorized( securitySession, ArchivaRoleConstants.OPERATION_ADD_ARTIFACT, dstRepositoryId ); if ( !authz ) { throw new ArchivaRestServiceException( ErrorMessage.of( ErrorKeys.PERMISSION_REPOSITORY_DENIED, dstRepositoryId, OPERATION_ADD_ARTIFACT ) ); } } catch ( AuthorizationException e ) { log.error( ""Error reading permission: {}"", e.getMessage(), e ); throw new ArchivaRestServiceException( ErrorMessage.of( ErrorKeys.AUTHORIZATION_ERROR, e.getMessage() ), 403); } }",unrelated,unrelated,True,,0.36689135432243347,0.6331086158752441
64,"protected String sendRequestForData(final OAuthService service, final Token accessToken, final String dataUrl, Verb verb) { logger.debug(""accessToken: {} / dataUrl: {}"", accessToken, dataUrl); val t0 = System.currentTimeMillis(); val request = createOAuthRequest(dataUrl, verb); signRequest(service, accessToken, request); final String body; final int code; try { var response = service.execute(request); code = response.getCode(); body = response.getBody(); } catch (final IOException | InterruptedException | ExecutionException e) { throw new HttpCommunicationException(""Error getting body: "" + e.getMessage()); } val t1 = System.currentTimeMillis(); logger.debug(""Request took: "" + (t1 - t0) + "" ms for: "" + dataUrl); logger.debug(""response code: {} / response body: {}"", code, body); if (code != 200) { throw new HttpCommunicationException(code, body); } return body; }",unrelated,unrelated,True,,0.003056216984987259,0.9969437718391418
65,"@Override public Optional<Credentials> extract(final CallContext ctx) { val webContext = ctx.webContext(); val logoutToken = webContext.getRequestParameter(""logout_token""); val sid = webContext.getRequestParameter(Pac4jConstants.OIDC_CLAIM_SESSIONID); if (logoutToken.isPresent()) { try { val jwt = JWTParser.parse(logoutToken.get()); if (jwt instanceof EncryptedJWT) { LOGGER.error(""Encrypted JWTs are not accepted for logout requests""); throw new BadRequestAction(); } String sessionId; if (configuration.isLogoutValidation()) { val claims = configuration.getOpMetadataResolver().getTokenValidator().validateLogoutToken(jwt); if (claims.getClaim(OidcConfiguration.NONCE) != null) { LOGGER.error(""The nonce claim should not exist for logout requests""); throw new BadRequestAction(); } val events = claims.getClaim(""events""); if (!(events instanceof Map mapEvents) || !mapEvents.containsKey(""http://schemas.openid.net/event/backchannel-logout"")) { LOGGER.error(""The events claim should contain the 'http://schemas.openid.net/event/backchannel-logout'"" + "" member name for logout requests""); throw new BadRequestAction(); } sessionId = (String) claims.getClaim(Pac4jConstants.OIDC_CLAIM_SESSIONID); if (StringUtils.isBlank(sessionId)) { LOGGER.error(""The sid claim is mandatory for logout requests""); throw new BadRequestAction(); } } else { ANNOUNCE_LOGOUT_VALIDATION_DISABLED.announce(); sessionId = (String) jwt.getJWTClaimsSet().getClaim(Pac4jConstants.OIDC_CLAIM_SESSIONID); } LOGGER.debug(""Handling back-channel logout for sessionId: {}"", sessionId); return Optional.of(new SessionKeyCredentials(LogoutType.BACK, sessionId)); } catch (final java.text.ParseException | BadJOSEException | JOSEException e) { LOGGER.error(""Cannot validate JWT logout token"", e); throw new BadRequestAction(); } } else if (sid.isPresent()) { val sessionId = sid.get(); LOGGER.debug(""Handling front-channel logout for sessionId: {}"", sessionId); return Optional.of(new SessionKeyCredentials(LogoutType.FRONT, sessionId)); } else { val computedCallbackUrl = client.computeFinalCallbackUrl(webContext); val parameters = retrieveParameters(webContext); AuthenticationResponse response; try { response = AuthenticationResponseParser.parse(new URI(computedCallbackUrl), parameters); } catch (final URISyntaxException | ParseException e) { throw new OidcException(e); } if (response instanceof AuthenticationErrorResponse) { LOGGER.error(""Bad authentication response, error={}"", ((AuthenticationErrorResponse) response).getErrorObject()); return Optional.empty(); } LOGGER.debug(""Authentication response successful""); var successResponse = (AuthenticationSuccessResponse) response; var metadata = configuration.getOpMetadataResolver().load(); if (metadata.supportsAuthorizationResponseIssuerParam() && !metadata.getIssuer().equals(successResponse.getIssuer())) { throw new OidcIssuerMismatchException(""Issuer mismatch, possible mix-up attack, received issuer: '"" + successResponse.getIssuer() + ""'""); } if (configuration.isWithState()) { val requestState = (State) configuration.getValueRetriever() .retrieve(ctx, client.getStateSessionAttributeName(), client) .orElseThrow(() -> new OidcMissingSessionStateException(""State cannot be determined"")); val responseState = successResponse.getState(); if (responseState == null) { throw new OidcMissingStateParameterException(""Missing state parameter""); } LOGGER.debug(""Request state: {}/response state: {}"", requestState, responseState); if (!requestState.equals(responseState)) { throw new OidcStateMismatchException( ""State parameter is different from the one sent in authentication request.""); } } else { OidcRedirectionActionBuilder.ANNOUNCE_WITH_STATE_DISABLED.announce(); } val credentials = new OidcCredentials(); val code = successResponse.getAuthorizationCode(); if (code != null) { credentials.setCode(code.getValue()); } val idToken = successResponse.getIDToken(); if (idToken != null) { credentials.setIdToken(idToken.serialize()); } val accessToken = successResponse.getAccessToken(); if (accessToken != null) { credentials.setAccessTokenObject(accessToken); } if (code == null && idToken == null && accessToken == null) { throw new TechnicalException(""Cannot accept empty OIDC credentials""); } return Optional.of(credentials); } }",unrelated,unrelated,True,,0.06009479984641075,0.9399052262306213
66,"protected List<String> getObservableRepos() { try { List<String> ids = userRepositories.getObservableRepositoryIds( getPrincipal() ); return ids == null ? Collections.<String>emptyList() : ids; } catch ( PrincipalNotFoundException e ) { log.warn( e.getMessage(), e ); } catch ( AccessDeniedException e ) { log.warn( e.getMessage(), e ); } catch ( ArchivaSecurityException e ) { log.warn( e.getMessage(), e ); } return Collections.emptyList(); }",unrelated,audit_accountability,False,true_unrelated_predicted_audit_accountability,0.9957423806190491,0.004257640801370144
67,"@Override public void beginScan( ManagedRepository repo, Date whenGathered ) throws ConsumerException { repoId = repo.getId(); this.repositoryDir = Paths.get( repo.getLocation() ); try { repositorySession = repositorySessionFactory.createSession(); } catch ( MetadataRepositoryException e ) { e.printStackTrace( ); } }",unrelated,audit_accountability,False,true_unrelated_predicted_audit_accountability,0.9896793365478516,0.010320649482309818
68,"private Logger logger = LoggerFactory.getLogger( ""org.apache.archiva.AuditLog"" );",audit_accountability,unrelated,False,true_audit_accountability_predicted_unrelated,0.000660295132547617,0.9993396401405334
69,"private boolean isAllowed( HttpServletRequest req, String repositoryId, String groupId, String artifactId ) throws UserNotFoundException, AccountLockedException, AuthenticationException, MustChangePasswordException, UnauthorizedException { String auth = req.getHeader( ""Authorization"" ); List<String> repoIds = new ArrayList<>(); if ( repositoryId != null ) { repoIds.add( repositoryId ); } else if ( artifactId != null && groupId != null ) { if ( auth != null ) { if ( !auth.toUpperCase().startsWith( ""BASIC "" ) ) { return false; } Decoder dec = new Base64(); String usernamePassword = """"; try { usernamePassword = new String( (byte[]) dec.decode( auth.substring( 6 ).getBytes() ) ); } catch ( DecoderException ie ) { log.warn( ""Error decoding username and password: {}"", ie.getMessage() ); } if ( usernamePassword == null || usernamePassword.trim().equals( """" ) ) { repoIds = getObservableRepos( UserManager.GUEST_USERNAME ); } else { String[] userCredentials = usernamePassword.split( "":"" ); repoIds = getObservableRepos( userCredentials[0] ); } } else { repoIds = getObservableRepos( UserManager.GUEST_USERNAME ); } } else { return false; } for ( String repoId : repoIds ) { try { AuthenticationResult result = httpAuth.getAuthenticationResult( req, null ); SecuritySession securitySession = httpAuth.getSecuritySession( req.getSession( true ) ); if ( servletAuth.isAuthenticated( req, result ) && servletAuth.isAuthorized( req, securitySession, repoId, ArchivaRoleConstants.OPERATION_READ_REPOSITORY ) ) { return true; } } catch ( AuthorizationException e ) { log.debug( ""AuthorizationException for repoId: {}"", repoId ); } catch ( UnauthorizedException e ) { log.debug( ""UnauthorizedException for repoId: {}"", repoId ); } } throw new UnauthorizedException( ""Access denied."" ); }",unrelated,unrelated,True,,0.000946316693443805,0.9990536570549011
70,"@Override public void update(final ArchivaIndexingContext context, final boolean fullUpdate) throws IndexUpdateFailedException { log.info( ""start download remote index for remote repository {}"", context.getRepository( ).getId( ) ); URI remoteUpdateUri; if ( !( context.getRepository( ) instanceof RemoteRepository ) || !(context.getRepository().supportsFeature(RemoteIndexFeature.class)) ) { throw new IndexUpdateFailedException( ""The context is not associated to a remote repository with remote index "" + context.getId( ) ); } else { RemoteIndexFeature rif = context.getRepository().getFeature( RemoteIndexFeature.class ); remoteUpdateUri = context.getRepository().getLocation().resolve(rif.getIndexUri()); } final RemoteRepository remoteRepository = (RemoteRepository) context.getRepository( ); executeUpdateFunction( context, indexingContext -> { try { Path tempIndexDirectory = Paths.get( indexingContext.getIndexDirectoryFile( ).getParent( ), "".tmpIndex"" ); Path indexCacheDirectory = Paths.get( indexingContext.getIndexDirectoryFile( ).getParent( ), "".indexCache"" ); Files.createDirectories( indexCacheDirectory ); if ( Files.exists( tempIndexDirectory ) ) { org.apache.archiva.common.utils.FileUtils.deleteDirectory( tempIndexDirectory ); } Files.createDirectories( tempIndexDirectory ); tempIndexDirectory.toFile( ).deleteOnExit( ); String baseIndexUrl = indexingContext.getIndexUpdateUrl( ); String wagonProtocol = remoteUpdateUri.toURL( ).getProtocol( ); NetworkProxy networkProxy = null; if ( remoteRepository.supportsFeature( RemoteIndexFeature.class ) ) { RemoteIndexFeature rif = remoteRepository.getFeature( RemoteIndexFeature.class ); if ( StringUtils.isNotBlank( rif.getProxyId( ) ) ) { networkProxy = proxyRegistry.getNetworkProxy( rif.getProxyId( ) ); if ( networkProxy == null ) { log.warn( ""your remote repository is configured to download remote index trought a proxy we cannot find id:{}"", rif.getProxyId( ) ); } } final StreamWagon wagon = (StreamWagon) wagonFactory.getWagon( new WagonFactoryRequest( wagonProtocol, remoteRepository.getExtraHeaders( ) ).networkProxy( networkProxy ) ); int readTimeout = (int) rif.getDownloadTimeout( ).toMillis( ) * 1000; wagon.setReadTimeout( readTimeout ); wagon.setTimeout( (int) remoteRepository.getTimeout( ).toMillis( ) * 1000 ); if ( wagon instanceof AbstractHttpClientWagon ) { HttpConfiguration httpConfiguration = new HttpConfiguration( ); HttpMethodConfiguration httpMethodConfiguration = new HttpMethodConfiguration( ); httpMethodConfiguration.setUsePreemptive( true ); httpMethodConfiguration.setReadTimeout( readTimeout ); httpConfiguration.setGet( httpMethodConfiguration ); AbstractHttpClientWagon.class.cast( wagon ).setHttpConfiguration( httpConfiguration ); } wagon.addTransferListener( new DownloadListener( ) ); ProxyInfo proxyInfo = null; if ( networkProxy != null ) { proxyInfo = new ProxyInfo( ); proxyInfo.setType( networkProxy.getProtocol( ) ); proxyInfo.setHost( networkProxy.getHost( ) ); proxyInfo.setPort( networkProxy.getPort( ) ); proxyInfo.setUserName( networkProxy.getUsername( ) ); proxyInfo.setPassword( new String(networkProxy.getPassword( )) ); } AuthenticationInfo authenticationInfo = null; if ( remoteRepository.getLoginCredentials( ) != null && ( remoteRepository.getLoginCredentials( ) instanceof PasswordCredentials ) ) { PasswordCredentials creds = (PasswordCredentials) remoteRepository.getLoginCredentials( ); authenticationInfo = new AuthenticationInfo( ); authenticationInfo.setUserName( creds.getUsername( ) ); authenticationInfo.setPassword( new String( creds.getPassword( ) ) ); } wagon.connect( new org.apache.maven.wagon.repository.Repository( remoteRepository.getId( ), baseIndexUrl ), authenticationInfo, proxyInfo ); Path indexDirectory = indexingContext.getIndexDirectoryFile( ).toPath( ); if ( !Files.exists( indexDirectory ) ) { Files.createDirectories( indexDirectory ); } ResourceFetcher resourceFetcher = new WagonResourceFetcher( log, tempIndexDirectory, wagon, remoteRepository ); IndexUpdateRequest request = new IndexUpdateRequest( indexingContext, resourceFetcher ); request.setForceFullUpdate( fullUpdate ); request.setLocalIndexCacheDir( indexCacheDirectory.toFile( ) ); indexUpdater.fetchAndUpdateIndex( request ); indexingContext.updateTimestamp( true ); } } catch ( AuthenticationException e ) { log.error( ""Could not login to the remote proxy for updating index of {}"", remoteRepository.getId( ), e ); throw new IndexUpdateFailedException( ""Login in to proxy failed while updating remote repository "" + remoteRepository.getId( ), e ); } catch ( ConnectionException e ) { log.error( ""Connection error during index update for remote repository {}"", remoteRepository.getId( ), e ); throw new IndexUpdateFailedException( ""Connection error during index update for remote repository "" + remoteRepository.getId( ), e ); } catch ( MalformedURLException e ) { log.error( ""URL for remote index update of remote repository {} is not correct {}"", remoteRepository.getId( ), remoteUpdateUri, e ); throw new IndexUpdateFailedException( ""URL for remote index update of repository is not correct "" + remoteUpdateUri, e ); } catch ( IOException e ) { log.error( ""IOException during index update of remote repository {}: {}"", remoteRepository.getId( ), e.getMessage( ), e ); throw new IndexUpdateFailedException( ""IOException during index update of remote repository "" + remoteRepository.getId( ) + ( StringUtils.isNotEmpty( e.getMessage( ) ) ? "": "" + e.getMessage( ) : """" ), e ); } catch ( WagonFactoryException e ) { log.error( ""Wagon for remote index download of {} could not be created: {}"", remoteRepository.getId( ), e.getMessage( ), e ); throw new IndexUpdateFailedException( ""Error while updating the remote index of "" + remoteRepository.getId( ), e ); } } ); }",unrelated,unrelated,True,,0.0007737126434221864,0.9992263317108154
71,"public static void closeResultSet(ResultSet rs) { if (rs != null) { try { rs.close(); } catch (SQLException ex) { if (LOGGER.isDebugEnabled()) { LOGGER.debug(""Could not close JDBC ResultSet"", ex); } } catch (Throwable ex) { if (LOGGER.isDebugEnabled()) { LOGGER.debug(""Unexpected exception on closing JDBC ResultSet"", ex); } } } }",unrelated,unrelated,True,,0.000774941872805357,0.9992250204086304
72,"@Override public void anonymousBind() throws LdapException { if ( LOG.isDebugEnabled() ) { LOG.debug( I18n.msg( I18n.MSG_04109_ANONYMOUS_BIND ) ); } BindRequest bindRequest = createBindRequest( StringConstants.EMPTY, Strings.EMPTY_BYTES ); BindResponse bindResponse = bind( bindRequest ); processResponse( bindResponse ); }",unrelated,audit_accountability,False,true_unrelated_predicted_audit_accountability,0.9961133003234863,0.0038866542745381594
73,"val code = connection.getResponseCode(); if (code == 200) { LOGGER.debug(""Authentication success for username: {}"", username); return HttpUtils.readBody(connection); } else if (code == 401 || code == 403) { LOGGER.info(""Authentication failure for username: {} -> {}"", username, HttpUtils.buildHttpErrorMessage(connection)); return null; } else { LOGGER.warn(""Unexpected error for username: {} -> {}"", username, HttpUtils.buildHttpErrorMessage(connection)); return null; }",audit_accountability,audit_accountability,True,,0.996607780456543,0.0033922295551747084
74,"public static final Logger logger = LoggerFactory.getLogger( ""org.apache.archiva.AuditLog"" );",audit_accountability,unrelated,False,true_audit_accountability_predicted_unrelated,0.000661465513985604,0.9993385672569275
75,"@Override public ActionStatus copyArtifact( ArtifactTransferRequest artifactTransferRequest ) throws ArchivaRestServiceException { String userName = getAuditInformation().getUser().getUsername(); if ( StringUtils.isBlank( userName ) ) { throw new ArchivaRestServiceException( ""copyArtifact call: userName not found"", null ); } if ( StringUtils.isBlank( artifactTransferRequest.getRepositoryId() ) ) { throw new ArchivaRestServiceException( ""copyArtifact call: sourceRepositoryId cannot be null"", null ); } if ( StringUtils.isBlank( artifactTransferRequest.getTargetRepositoryId() ) ) { throw new ArchivaRestServiceException( ""copyArtifact call: targetRepositoryId cannot be null"", null ); } ManagedRepository source = null; source = repositoryRegistry.getManagedRepository( artifactTransferRequest.getRepositoryId() ); if ( source == null ) { throw new ArchivaRestServiceException( ""cannot find repository with id "" + artifactTransferRequest.getRepositoryId(), null ); } ManagedRepository target = null; target = repositoryRegistry.getManagedRepository( artifactTransferRequest.getTargetRepositoryId() ); if ( target == null ) { throw new ArchivaRestServiceException( ""cannot find repository with id "" + artifactTransferRequest.getTargetRepositoryId(), null ); } if ( StringUtils.isBlank( artifactTransferRequest.getGroupId() ) ) { throw new ArchivaRestServiceException( ""groupId is mandatory"", null ); } if ( StringUtils.isBlank( artifactTransferRequest.getArtifactId() ) ) { throw new ArchivaRestServiceException( ""artifactId is mandatory"", null ); } if ( StringUtils.isBlank( artifactTransferRequest.getVersion() ) ) { throw new ArchivaRestServiceException( ""version is mandatory"", null ); } if ( VersionUtil.isSnapshot( artifactTransferRequest.getVersion() ) ) { throw new ArchivaRestServiceException( ""copy of SNAPSHOT not supported"", null ); } User user = null; try { user = securitySystem.getUserManager().findUser( userName ); } catch ( UserNotFoundException e ) { throw new ArchivaRestServiceException( ""user "" + userName + "" not found"", e ); } catch ( UserManagerException e ) { throw new ArchivaRestServiceException( ""ArchivaRestServiceException:"" + e.getMessage(), e ); } AuthenticationResult authn = new AuthenticationResult( true, userName, null ); SecuritySession securitySession = new DefaultSecuritySession( authn, user ); try { boolean authz = securitySystem.isAuthorized( securitySession, ArchivaRoleConstants.OPERATION_READ_REPOSITORY, artifactTransferRequest.getRepositoryId() ); if ( !authz ) { throw new ArchivaRestServiceException( ""not authorized to access repo:"" + artifactTransferRequest.getRepositoryId(), null ); } } catch ( AuthorizationException e ) { log.error( ""error reading permission: {}"", e.getMessage(), e ); throw new ArchivaRestServiceException( e.getMessage(), e ); } try { boolean authz = securitySystem.isAuthorized( securitySession, ArchivaRoleConstants.OPERATION_ADD_ARTIFACT, artifactTransferRequest.getTargetRepositoryId() ); if ( !authz ) { throw new ArchivaRestServiceException( ""not authorized to write to repo:"" + artifactTransferRequest.getTargetRepositoryId(), null ); } } catch ( AuthorizationException e ) { log.error( ""error reading permission: {}"", e.getMessage(), e ); throw new ArchivaRestServiceException( e.getMessage(), e ); } String packaging = StringUtils.trim( artifactTransferRequest.getPackaging() ); ItemSelector selector = ArchivaItemSelector.builder( ) .withProjectId( artifactTransferRequest.getArtifactId( ) ) .withArtifactId( artifactTransferRequest.getArtifactId( ) ) .withNamespace( artifactTransferRequest.getGroupId( ) ) .withArtifactVersion( artifactTransferRequest.getVersion( ) ) .withClassifier( artifactTransferRequest.getClassifier( ) ) .withExtension( StringUtils.isEmpty( packaging ) ? ""jar"" : packaging ) .build( ); try { ManagedRepositoryContent sourceRepository = getManagedRepositoryContent( artifactTransferRequest.getRepositoryId() ); BaseRepositoryContentLayout layout = sourceRepository.getLayout( BaseRepositoryContentLayout.class ); org.apache.archiva.repository.content.Artifact sourceArtifact = layout.getArtifact( selector ); if ( !sourceArtifact.exists() ) { log.error( ""cannot find artifact {}"", artifactTransferRequest ); throw new ArchivaRestServiceException( ""cannot find artifact "" + artifactTransferRequest.toString(), null ); } StorageAsset artifactFile = sourceArtifact.getAsset( ); ManagedRepositoryContent targetRepository = getManagedRepositoryContent( artifactTransferRequest.getTargetRepositoryId() ); String artifactPath = artifactFile.getPath( ); int lastIndex = artifactPath.lastIndexOf( '/' ); String path = artifactPath.substring( 0, lastIndex ); StorageAsset targetDir = target.getAsset( path ); Date lastUpdatedTimestamp = Calendar.getInstance().getTime(); int newBuildNumber = 1; String timestamp = null; StorageAsset versionMetadataFile = target.getAsset(path + ""/"" + MetadataTools.MAVEN_METADATA ); getMetadata( targetRepository.getRepository().getType(), versionMetadataFile ); if ( !targetDir.exists() ) { targetDir = target.addAsset(targetDir.getPath(), true); targetDir.create(); } String filename = artifactPath.substring( lastIndex + 1 ); boolean fixChecksums = !( archivaAdministration.getKnownContentConsumers().contains( ""create-missing-checksums"" ) ); StorageAsset targetFile = target.getAsset(targetDir.getPath() + ""/"" + filename ); if ( targetFile.exists() && target.blocksRedeployments()) { throw new ArchivaRestServiceException( ""artifact already exists in target repo: "" + artifactTransferRequest.getTargetRepositoryId() + "" and redeployment blocked"", null ); } else { copyFile(artifactFile, targetFile, fixChecksums ); queueRepositoryTask( target.getId(), targetFile ); } String pomFilename = filename; if ( StringUtils.isNotBlank( artifactTransferRequest.getClassifier() ) ) { pomFilename = StringUtils.remove( pomFilename, ""-"" + artifactTransferRequest.getClassifier() ); } pomFilename = FilenameUtils.removeExtension( pomFilename ) + "".pom""; StorageAsset pomFile = source.getAsset( artifactPath.substring( 0, artifactPath.lastIndexOf( '/' ) )+""/""+ pomFilename ); if ( pomFile != null && pomFile.exists() ) { StorageAsset targetPomFile = target.getAsset( targetDir.getPath() + ""/"" + pomFilename ); copyFile(pomFile, targetPomFile, fixChecksums ); queueRepositoryTask( target.getId(), targetPomFile ); } if ( !archivaAdministration.getKnownContentConsumers().contains( ""metadata-updater"" ) ) { updateProjectMetadata( target.getType(), target, targetDir, lastUpdatedTimestamp, timestamp, newBuildNumber, fixChecksums, artifactTransferRequest ); } String msg = ""Artifact \'"" + artifactTransferRequest.getGroupId() + "":"" + artifactTransferRequest.getArtifactId() + "":"" + artifactTransferRequest.getVersion() + ""\' was successfully deployed to repository \'"" + artifactTransferRequest.getTargetRepositoryId() + ""\'""; log.debug(""copyArtifact {}"", msg); } catch ( RepositoryException | LayoutException e ) { log.error( ""RepositoryException: {}"", e.getMessage(), e ); throw new ArchivaRestServiceException( e.getMessage(), e ); } catch ( RepositoryAdminException e ) { log.error( ""RepositoryAdminException: {}"", e.getMessage(), e ); throw new ArchivaRestServiceException( e.getMessage(), e ); } catch ( IOException e ) { log.error( ""IOException: {}"", e.getMessage(), e ); throw new ArchivaRestServiceException( e.getMessage(), e ); } return ActionStatus.SUCCESS; }",unrelated,unrelated,True,,0.10309610515832901,0.896903932094574
76,"if (sessionStore == null) { LOGGER.warn(""No session store. Cannot destroy session""); return; }",audit_accountability,audit_accountability,True,,0.9961209893226624,0.0038790078833699226
77,"private List<String> getObservableRepos( String principal ) { try { return userRepositories.getObservableRepositoryIds( principal ); } catch ( PrincipalNotFoundException e ) { log.warn( e.getMessage(), e ); } catch ( AccessDeniedException e ) { log.warn( e.getMessage(), e ); } catch ( ArchivaSecurityException e ) { log.warn( e.getMessage(), e ); } return Collections.emptyList(); }",unrelated,audit_accountability,False,true_unrelated_predicted_audit_accountability,0.996346652507782,0.0036533456295728683
78,"@Override public Object perform(final Config config, final SecurityGrantedAccessAdapter securityGrantedAccessAdapter, final String clients, final String authorizers, final String matchers, final FrameworkParameters parameters) { LOGGER.debug(""=== SECURITY ===""); val ctx = buildContext(config, parameters); val webContext = ctx.webContext(); val sessionStore = ctx.sessionStore(); val httpActionAdapter = config.getHttpActionAdapter(); assertNotNull(""httpActionAdapter"", httpActionAdapter); HttpAction action; try { assertNotNull(""clientFinder"", clientFinder); assertNotNull(""authorizationChecker"", authorizationChecker); assertNotNull(""matchingChecker"", matchingChecker); val configClients = config.getClients(); assertNotNull(""configClients"", configClients); LOGGER.debug(""url: {}"", webContext.getFullRequestURL()); LOGGER.debug(""clients: {} | matchers: {}"", clients, matchers); val currentClients = clientFinder.find(configClients, webContext, clients); LOGGER.debug(""currentClients: {}"", currentClients); if (matchingChecker.matches(ctx, matchers, config.getMatchers(), currentClients)) { val manager = ctx.profileManagerFactory().apply(webContext, sessionStore); manager.setConfig(config); var profiles = this.loadProfilesFromSession ? loadProfiles(ctx, manager, currentClients) : List.<UserProfile>of(); LOGGER.debug(""Loaded profiles (from session: {}): {} "", this.loadProfilesFromSession, profiles); if (isEmpty(profiles) && !isEmpty(currentClients)) { var updated = false; for (val currentClient : currentClients) { if (currentClient instanceof DirectClient directClient) { LOGGER.debug(""Performing authentication for direct client: {}"", currentClient); var credentials = currentClient.getCredentials(ctx).orElse(null); credentials = currentClient.validateCredentials(ctx, credentials).orElse(null); LOGGER.debug(""credentials: {}"", credentials); if (credentials != null && credentials.isForAuthentication()) { val optProfile = currentClient.getUserProfile(ctx, credentials); LOGGER.debug(""profile: {}"", optProfile); if (optProfile.isPresent()) { val profile = optProfile.get(); val saveProfileInSession = directClient.getSaveProfileInSession(webContext, profile); val multiProfile = directClient.isMultiProfile(webContext, profile); LOGGER.debug(""saveProfileInSession: {} / multiProfile: {}"", saveProfileInSession, multiProfile); manager.save(saveProfileInSession, profile, multiProfile); updated = true; if (!multiProfile) { break; } } } } } if (updated) { profiles = loadProfiles(ctx, manager, currentClients); LOGGER.debug(""Reloaded profiles: {}"", profiles); } } if (isNotEmpty(profiles)) { LOGGER.debug(""authorizers: {}"", authorizers); if (authorizationChecker.isAuthorized(webContext, sessionStore, profiles, authorizers, config.getAuthorizers(), currentClients)) { LOGGER.debug(""authenticated and authorized -> grant access""); return securityGrantedAccessAdapter.adapt(webContext, sessionStore, profiles); } else { LOGGER.debug(""forbidden""); action = forbidden(ctx, currentClients, profiles, authorizers); } } else { if (startAuthentication(ctx, currentClients)) { LOGGER.debug(""Starting authentication""); saveRequestedUrl(ctx, currentClients, config.getClients().getAjaxRequestResolver()); action = redirectToIdentityProvider(ctx, currentClients); } else { LOGGER.debug(""unauthorized""); action = unauthorized(ctx, currentClients); } } } else { LOGGER.debug(""no matching for this request -> grant access""); return securityGrantedAccessAdapter.adapt(webContext, sessionStore, Collections.emptyList()); } } catch (final Exception e) { return handleException(e, httpActionAdapter, webContext); } return httpActionAdapter.adapt(action, webContext); }",unrelated,unrelated,True,,0.2498241811990738,0.7501758337020874
79,"protected ResultSetType resolveResultSetType(String alias) { try { return alias == null ? null : ResultSetType.valueOf(alias); } catch (IllegalArgumentException e) { throw new BuilderException(""Error resolving ResultSetType. Cause: "" + e, e); } }",unrelated,unrelated,True,,0.0006803821888752282,0.9993196725845337
80,@Override public RandomProviderState saveState() { return new RandomProviderDefaultState(getStateInternal()); },unrelated,unrelated,True,,0.0006825877935625613,0.9993174076080322
81,"private GuideTableDiscreteSampler(UniformRandomProvider rng, double[] cumulativeProbabilities, int[] guideTable) { this.rng = rng; this.cumulativeProbabilities = cumulativeProbabilities; this.guideTable = guideTable; }",unrelated,unrelated,True,,0.0007046511163935065,0.9992953538894653
82,"private int skipWS(String expression, int p) { for (int i = p; i < expression.length(); i++) { if (expression.charAt(i) > 0x20) { return i; } } return expression.length(); }",unrelated,unrelated,True,,0.0006768794264644384,0.9993231296539307
83,"private BoxMullerGaussianSampler(double mean, double standardDeviation, UniformRandomProvider rng) { super(null); this.rng = rng; this.mean = mean; this.standardDeviation = standardDeviation; }",unrelated,unrelated,True,,0.0006701882812194526,0.9993298053741455
84,"private PoissonSamplerCache(int minN, int maxN, LargeMeanPoissonSamplerState[] states) { this.minN = minN; this.maxN = maxN; this.values = states; }",unrelated,unrelated,True,,0.0006777537637390196,0.9993222951889038
85,@Override public long next() { final int p = bufferPosition; if (bufferPosition < PHILOX_BUFFER_SIZE) { bufferPosition = p + 1; return buffer[p]; } incrementCounter(); rand10(); bufferPosition = 1; return buffer[0]; },unrelated,unrelated,True,,0.0007186403963714838,0.9992813467979431
86,public void setLogImpl(Class<? extends Log> logImpl) { if (logImpl != null) { this.logImpl = logImpl; LogFactory.useCustomLogging(this.logImpl); } },unrelated,unrelated,True,,0.0006986603839322925,0.9993013143539429
87,@Override public UniformRandomProvider jump() { final UniformRandomProvider copy = new L32X64Mix(this); ls = M * ls + la; resetCachedState(); return copy; },unrelated,unrelated,True,,0.0006779349641874433,0.9993220567703247
88,"private static void putInt(int v, byte[] buffer, int index) { buffer[index ] = (byte) (v & INT_LOWEST_BYTE_MASK); buffer[index + 1] = (byte)((v >>> 8) & INT_LOWEST_BYTE_MASK); buffer[index + 2] = (byte)((v >>> 16) & INT_LOWEST_BYTE_MASK); buffer[index + 3] = (byte) (v >>> 24); }",unrelated,unrelated,True,,0.0006946384091861546,0.9993053674697876
89,"private <E> List<E> selectList() throws SQLException { Executor localExecutor = executor; if (Thread.currentThread().getId() != this.creatorThreadId || localExecutor.isClosed()) { localExecutor = newExecutor(); } try { return localExecutor.query(mappedStatement, parameterObject, RowBounds.DEFAULT, Executor.NO_RESULT_HANDLER, cacheKey, boundSql); } finally { if (localExecutor != executor) { localExecutor.close(false); } } }",unrelated,unrelated,True,,0.0006833600345999002,0.9993166923522949
90,public List<ResultMapping> resolveWithConstructor() { if (constructorResultMappings.isEmpty()) { return constructorResultMappings; } final List<ConstructorMetaInfo> matchingConstructorCandidates = retrieveConstructorCandidates( constructorResultMappings.size()); if (matchingConstructorCandidates.isEmpty()) { return constructorResultMappings; } final Set<String> constructorArgsByName = constructorResultMappings.stream().map(ResultMapping::getProperty) .filter(Objects::nonNull).collect(Collectors.toCollection(LinkedHashSet::new)); final boolean allMappingsHavePropertyNames = verifyPropertyNaming(constructorArgsByName);,unrelated,unrelated,True,,0.0006708480650559068,0.9993292093276978
91,@Override public Class<?> getSetterType(String name) { PropertyTokenizer prop = new PropertyTokenizer(name); if (prop.hasNext()) { MetaObject metaValue = metaObject.metaObjectForProperty(prop.getIndexedName()); if (metaValue == SystemMetaObject.NULL_META_OBJECT) { return Object.class; } else { return metaValue.getSetterType(prop.getChildren()); } } if (map.get(name) != null) { return map.get(name).getClass(); } else { return Object.class; } },unrelated,unrelated,True,,0.0007314911927096546,0.9992684721946716
92,"private void applyConstructorArgs(Arg[] args, Class<?> resultType, List<ResultMapping> resultMappings, String resultMapId) { final List<ResultMapping> mappings = new ArrayList<>(); for (Arg arg : args) { List<ResultFlag> flags = new ArrayList<>(); flags.add(ResultFlag.CONSTRUCTOR); if (arg.id()) { flags.add(ResultFlag.ID); } @SuppressWarnings(""unchecked"") Class<? extends TypeHandler<?>> typeHandler = (Class<? extends TypeHandler<?>>) (arg .typeHandler() == UnknownTypeHandler.class ? null : arg.typeHandler()); ResultMapping resultMapping = assistant.buildResultMapping(resultType, nullOrEmpty(arg.name()), nullOrEmpty(arg.column()), arg.javaType() == void.class ? null : arg.javaType(), arg.jdbcType() == JdbcType.UNDEFINED ? null : arg.jdbcType(), nullOrEmpty(arg.select()), nullOrEmpty(arg.resultMap()), null, nullOrEmpty(arg.columnPrefix()), typeHandler, flags, null, null, false); mappings.add(resultMapping); } final ResultMappingConstructorResolver resolver = new ResultMappingConstructorResolver(configuration, mappings,",unrelated,unrelated,True,,0.0006675615441054106,0.9993323683738708
93,private MetaObject getParamMetaObject() { if (paramMetaObject != null) { return paramMetaObject; } paramMetaObject = configuration.newMetaObject(parameterObject); return paramMetaObject; },unrelated,unrelated,True,,0.0006804775330238044,0.9993195533752441
94,public int getActiveConnectionCount() { lock.lock(); try { return activeConnections.size(); } finally { lock.unlock(); } },unrelated,unrelated,True,,0.000741267460398376,0.9992586970329285
95,"@Override public BigDecimal getNullableResult(ResultSet rs, String columnName) throws SQLException { return rs.getBigDecimal(columnName); }",unrelated,unrelated,True,,0.000700238801073283,0.9992997646331787
96,"@Override public void error(String s, Throwable e) { logger.log(MARKER, FQCN, LocationAwareLogger.ERROR_INT, s, null, e); }",unrelated,unrelated,True,,0.0060335625894367695,0.9939664602279663
97,"public PreparedStatementHandler(Executor executor, MappedStatement mappedStatement, Object parameter, RowBounds rowBounds, ResultHandler resultHandler, BoundSql boundSql) { super(executor, mappedStatement, parameter, rowBounds, resultHandler, boundSql); }",unrelated,unrelated,True,,0.0006782851414754987,0.999321699142456
98,"private void parseSelectKeyNodes(String parentId, List<XNode> list, Class<?> parameterTypeClass, LanguageDriver langDriver, String skRequiredDatabaseId) { for (XNode nodeToHandle : list) { String id = parentId + SelectKeyGenerator.SELECT_KEY_SUFFIX; String databaseId = nodeToHandle.getStringAttribute(""databaseId""); if (databaseIdMatchesCurrent(id, databaseId, skRequiredDatabaseId)) { parseSelectKeyNode(id, nodeToHandle, parameterTypeClass, langDriver, databaseId); } } }",unrelated,unrelated,True,,0.000729173538275063,0.9992708563804626
99,private void setState(long[] state) { key0 = state[0]; key1 = state[1]; counter0 = state[2]; counter1 = state[3]; counter2 = state[4]; counter3 = state[5]; },unrelated,unrelated,True,,0.0006951470277272165,0.9993048906326294
100,"public Class<?> getGetterType(String propertyName) { Class<?> clazz = getTypes.getOrDefault(propertyName, nullEntry).getValue(); if (clazz == null) { throw new ReflectionException(""There is no getter for property named '"" + propertyName + ""' in '"" + clazz + ""'""); } return clazz; }",unrelated,unrelated,True,,0.0006888050120323896,0.9993112087249756
101,"@Override protected void setStateInternal(byte[] s) { final byte[][] c = splitStateInternal(s, (N + 1) * 4); final int[] tmp = NumberFactory.makeIntArray(c[0]); System.arraycopy(tmp, 0, mt, 0, N); mti = tmp[N]; super.setStateInternal(c[1]); }",unrelated,unrelated,True,,0.0006806306191720068,0.9993194341659546
102,"@Override public <E> List<E> query(MappedStatement ms, Object parameterObject, RowBounds rowBounds, ResultHandler resultHandler) throws SQLException { BoundSql boundSql = ms.getBoundSql(parameterObject); CacheKey key = createCacheKey(ms, parameterObject, rowBounds, boundSql); return query(ms, parameterObject, rowBounds, resultHandler, key, boundSql); }",unrelated,unrelated,True,,0.0006841123686172068,0.9993158578872681
103,private boolean isLazy(Result result) { boolean isLazy = configuration.isLazyLoadingEnabled(); if (!result.one().select().isEmpty() && FetchType.DEFAULT != result.one().fetchType()) { isLazy = result.one().fetchType() == FetchType.LAZY; } else if (!result.many().select().isEmpty() && FetchType.DEFAULT != result.many().fetchType()) { isLazy = result.many().fetchType() == FetchType.LAZY; } return isLazy; },unrelated,unrelated,True,,0.0006897367420606315,0.9993102550506592
104,public CacheBuilder addDecorator(Class<? extends Cache> decorator) { if (decorator != null) { this.decorators.add(decorator); } return this; },unrelated,unrelated,True,,0.0007420936599373817,0.9992578625679016
105,@Override public void clear() { lastClear = System.currentTimeMillis(); delegate.clear(); },unrelated,unrelated,True,,0.0010851596016436815,0.9989148378372192
106,"@Override protected Statement instantiateStatement(Connection connection) throws SQLException { String sql = boundSql.getSql(); if (mappedStatement.getResultSetType() == ResultSetType.DEFAULT) { return connection.prepareCall(sql); } return connection.prepareCall(sql, mappedStatement.getResultSetType().getValue(), ResultSet.CONCUR_READ_ONLY); }",unrelated,unrelated,True,,0.0006832529907114804,0.9993168115615845
107,"private static <T> SharedStateDiscreteSampler createSampler(UniformRandomProvider rng, List<T> collection, double[] probabilities) { if (probabilities.length != collection.size()) { throw new IllegalArgumentException(""Size mismatch: "" + probabilities.length + "" != "" + collection.size()); } return GuideTableDiscreteSampler.of(rng, probabilities); }",unrelated,unrelated,True,,0.0006653426680713892,0.9993346333503723
108,"private ResultMapping buildResultMappingFromContext(XNode context, Class<?> resultType, List<ResultFlag> flags) { String property; if (flags.contains(ResultFlag.CONSTRUCTOR)) { property = context.getStringAttribute(""name""); } else { property = context.getStringAttribute(""property""); } String column = context.getStringAttribute(""column""); String javaType = context.getStringAttribute(""javaType""); String jdbcType = context.getStringAttribute(""jdbcType""); String nestedSelect = context.getStringAttribute(""select""); String nestedResultMap = context.getStringAttribute(""resultMap"", () -> processNestedResultMappings(context, List.of(), resultType)); String notNullColumn = context.getStringAttribute(""notNullColumn""); String columnPrefix = context.getStringAttribute(""columnPrefix""); String typeHandler = context.getStringAttribute(""typeHandler""); String resultSet = context.getStringAttribute(""resultSet""); String foreignColumn = context.getStringAttribute(""foreignColumn""); boolean lazy = ""lazy"" .equals(context.getStringAttribute(""fetchType"", configuration.isLazyLoadingEnabled() ? ""lazy"" : ""eager""));",unrelated,unrelated,True,,0.0006966364453546703,0.9993033409118652
109,@Override public <E> Cursor<E> queryCursor(Statement statement) throws SQLException { return delegate.queryCursor(statement); },unrelated,unrelated,True,,0.0006712008034810424,0.9993288516998291
110,"private JdbcType safeGetJdbcTypeForColumn(ResultSetMetaData rsmd, Integer columnIndex) { try { return JdbcType.forCode(rsmd.getColumnType(columnIndex)); } catch (Exception e) { return null; } }",unrelated,unrelated,True,,0.0006513011758215725,0.9993487000465393
111,@Override public int next() { final int indexRm1 = TABLE.getIndexPred(index); final int v0 = v[index]; final int vM1 = v[TABLE.getIndexM1(index)]; final int vM2 = v[TABLE.getIndexM2(index)]; final int vM3 = v[TABLE.getIndexM3(index)]; final int z0 = v[indexRm1]; final int z1 = v0 ^ (vM1 ^ (vM1 >>> 8)); final int z2 = (vM2 ^ (vM2 << 19)) ^ (vM3 ^ (vM3 << 14)); final int z3 = z1 ^ z2; final int z4 = (z0 ^ (z0 << 11)) ^ (z1 ^ (z1 << 7)) ^ (z2 ^ (z2 << 13)); v[index] = z3; v[indexRm1] = z4; index = indexRm1; return z4;,unrelated,unrelated,True,,0.0006763815763406456,0.9993236064910889
112,"private void linkToParents(ResultSet rs, ResultMapping parentMapping, Object rowValue) throws SQLException { CacheKey parentKey = createKeyForMultipleResults(rs, parentMapping, parentMapping.getColumn(), parentMapping.getForeignColumn()); List<PendingRelation> parents = pendingRelations.get(parentKey); if (parents != null) { for (PendingRelation parent : parents) { if (parent != null && rowValue != null) { linkObjects(parent.metaObject, parent.propertyMapping, rowValue); } } } }",unrelated,unrelated,True,,0.002051735296845436,0.9979482293128967
113,PendingCreationKey(ResultMapping constructorMapping) { this.resultMapId = constructorMapping.getNestedResultMapId(); this.constructorColumnPrefix = constructorMapping.getColumnPrefix(); },unrelated,unrelated,True,,0.002486500423401594,0.9975135326385498
114,"private static long sum(long[] frequencies) { if (frequencies == null || frequencies.length == 0) { throw new IllegalArgumentException(""frequencies must contain at least 1 value""); } long m = 0; long signFlag = 0; for (final long o : frequencies) { m += o; signFlag |= o | m; } if (signFlag < 0) { for (final long o : frequencies) { if (o < 0) {",unrelated,unrelated,True,,0.0006528124795295298,0.9993471503257751
115,@Override public String[] getSetterNames() { return map.keySet().toArray(new String[0]); },unrelated,unrelated,True,,0.0007119377260096371,0.9992881417274475
116,"private InverseTransformParetoSampler(double scale, double shape, UniformRandomProvider rng) { super(null); this.rng = rng; this.scale = scale; this.oneOverShape = 1 / shape; nextDouble = shape >= 1 ? InternalUtils::makeNonZeroDouble : InternalUtils::makeDouble; }",unrelated,unrelated,True,,0.0006661770748905838,0.9993337988853455
117,public long getClaimedOverdueConnectionCount() { lock.lock(); try { return claimedOverdueConnectionCount; } finally { lock.unlock(); } },unrelated,unrelated,True,,0.000723060336895287,0.9992769360542297
118,"public static double[] shuffle(UniformRandomProvider rng, double[] array) { int i = array.length; for (; i > BATCH_2; --i) { swap(array, i - 1, rng.nextInt(i)); } final int[] productBound = {i * (i - 1)}; for (; i > 1; i -= 2) { final int[] indices = randomBounded2(i, i - 1, productBound, rng); final int index1 = indices[0]; final int index2 = indices[1]; swap(array, i - 1, index1); swap(array, i - 2, index2); } return array; }",unrelated,unrelated,True,,0.0006528684752993286,0.9993471503257751
119,"@Override public Reader getNullableResult(ResultSet rs, String columnName) throws SQLException { return toReader(rs.getClob(columnName)); }",unrelated,unrelated,True,,0.0006784965516999364,0.999321460723877
120,"@Override public int next() { z = computeNew(36969, z); w = computeNew(18000, w); final int mwc = (z << 16) + w; jsr ^= jsr << 13; jsr ^= jsr >>> 17; jsr ^= jsr << 5; jcong = 69069 * jcong + 1234567; return (mwc ^ jcong) + jsr; }",unrelated,unrelated,True,,0.0006837148102931678,0.9993163347244263
121,"@SuppressWarnings({""rawtypes"", ""unchecked""}) public static <T> void shuffle(UniformRandomProvider rng, List<T> list) { if (list instanceof RandomAccess || list.size() < RANDOM_ACCESS_SIZE_THRESHOLD) { ArraySampler.shuffle(rng, list); } else { final Object[] array = list.toArray(); ArraySampler.shuffle(rng, array); final ListIterator it = list.listIterator(); for (final Object item : array) { it.next(); it.set(item); } } }",unrelated,unrelated,True,,0.0006661351071670651,0.9993337988853455
122,"private void cacheElement(XNode context) { if (context != null) { String type = context.getStringAttribute(""type"", ""PERPETUAL""); Class<? extends Cache> typeClass = typeAliasRegistry.resolveAlias(type); String eviction = context.getStringAttribute(""eviction"", ""LRU""); Class<? extends Cache> evictionClass = typeAliasRegistry.resolveAlias(eviction); Long flushInterval = context.getLongAttribute(""flushInterval""); Integer size = context.getIntAttribute(""size""); boolean readWrite = !context.getBooleanAttribute(""readOnly"", false); boolean blocking = context.getBooleanAttribute(""blocking"", false); Properties props = context.getChildrenAsProperties(); builderAssistant.useNewCache(typeClass, evictionClass, flushInterval, size, readWrite, blocking, props); } }",unrelated,unrelated,True,,0.0007082839729264379,0.9992916584014893
123,"@Override protected void setStateInternal(byte[] s) { final byte[][] c = splitStateInternal(s, SEED_SIZE * 8); setState(NumberFactory.makeLongArray(c[0])); super.setStateInternal(c[1]); }",unrelated,unrelated,True,,0.0006698473007418215,0.9993301630020142
124,"public static Type resolveFieldType(Field field, Type srcType) { Type fieldType = field.getGenericType(); Class<?> declaringClass = field.getDeclaringClass(); return resolveType(fieldType, srcType, declaringClass); }",unrelated,unrelated,True,,0.0006558888126164675,0.9993440508842468
125,private void finishJump() { resetCachedState(); if (bufferPosition < PHILOX_BUFFER_SIZE) { rand10(); } },unrelated,audit_accountability,False,true_unrelated_predicted_audit_accountability,0.9718952775001526,0.028104670345783234