Question: I have daily rainfall data which I have converted to yearwise cumulative value using following code

```
library(seas)
library(data.table)
library(ggplot2)

#Loading data
data(mscdata)
dat <- (mksub(mscdata, id=1108447))
dat$julian.date <- as.numeric(format(dat$date, "%j"))
DT <- data.table(dat)
DT[, Cum.Sum := cumsum(rain), by=list(year)]

df <- cbind.data.frame(day=dat$julian.date,cumulative=DT$Cum.Sum)

```

Then I want to apply segmented regression year-wise to have year-wise breakpoints. I could able to do it for single year like

```
library("segmented")
x <- subset(dat,year=="1984")$julian.date
y <- subset(DT,year=="1984")$Cum.Sum
fit.lm<-lm(y~x)
segmented(fit.lm, seg.Z = ~ x, npsi=3)

```

I have used `npsi = 3` to have 3 breakpoints. Now how to dinimically apply it year-wise segmented regression and have the estimated breakpoints?

Answer: 
```java
public class SecurityConfig extends WebSecurityConfigurerAdapter {
    @Override
    protected void configure(AuthenticationManagerBuilder auth)
        throws Exception {
        auth.inMemoryAuthentication().withUser("user1").password("{noop}Secret1").roles("USER");
    }

    @Override
    public void configure(HttpSecurity http) throws Exception {
        http.csrf().disable().authorizeRequests()
            .antMatchers("/").permitAll()
            .antMatchers("/claims/id/").hasRole("USER")
            .and()
            .httpBasic();
    }
}

```

* path is `/claims/id/`, not `/id/`
* you defined `USER` as role name, not as authority name, so required `hasRole()`
* call `httpBasic()` to to basic-auth ([10.10.2. Basic Authentication](https://docs.spring.io/spring-security/site/docs/5.3.3.RELEASE/reference/html5/#servlet-authentication-basic))
* add a prefix `{noop}` to password ([Password Storage Format](https://docs.spring.io/spring-security/site/docs/5.3.3.RELEASE/reference/html5/#authentication-password-storage-dpe-format))

[example code](https://github.com/yukihane/stackoverflow-qa/tree/master/en62574231)
try this

```
     http.csrf().disable().authorizeRequests()
            .antMatchers("/id/**").hasAnyRole("USER").and()
            .authorizeRequests().antMatchers("/").permitAll();

```