- Change imports to new correct strategy names:
NbDummyAuthProvider
->NbDummyAuthStrategy
NbEmailPassAuthProvider
->NbPasswordAuthStrategy
(could be used not only withemail
)NbAbstractAuthProvider
->NbAuthStrategy
- Change auth forms configuration
provider
key tostrategy
, so instead of
`NbAuthModule.forRoot({
forms: {
login: {
provider: 'email',
},
},
})`
should be:
`NbAuthModule.forRoot({
forms: {
login: {
strategy: 'email', // provider -> strategy
},
},
})`
- Register strategies through special
setup
method, so instead of theproviders
object, where object key - is a strategy name and value is a configuration:
providers: {
email: {
service: NbEmailPassAuthProvider,
config: { ... }
}
}
should be an array (called strategies
) which accepts result of a call of setup
method of a strategy,
which in its turn accepts a configuration, with a name
key.
strategies: [
NbPasswordAuthStrategy.setup({ name: 'email', ... }),
]
Strategy configuration is type-checked now.
- Remove
NB_AUTH_TOKEN_CLASS
imports and usage. Token class is passed through strategy configuration, like this:
@NgModule({
imports: [
// ...
NbAuthModule.forRoot({
strategies: [
NbPasswordAuthStrategy.setup({
name: 'email',
token: {
class: NbAuthJWTToken, // <----
}
}),
],
}),
],
});
In case you have a custom token - add NAME
static property.