preparation
Oauth :
Open authentication
1. Federated Authentication
2.Delegated Authorization
user--> client --> Authentication server
| <--
| Token
|
--Token---->
Resource Server
<----Data
Grant Types :(Oauth Flows): The way it Authentication and authorization done.
1) authentication code
a. Client (Web app) Registered with authentication server with client id and secret.
b.When the user access client(web page), redirects to authentication server login page to identify yourself.
c.authentication server grants access to webpage(client) with authentication code.
d.Client sends back code,client Id and secret to authentication server.
c. Authentication server validates client and give back the generated token.
d. client sends the token to Resource server to access user data
--> Used in WAN, when app accssed across the internet.
2) Password :
a. Client (Web app) Registered with authentication server with client id and secret.
b.When the user access client(web page),it takes directly user name ,password and send with client ID,secret to authentication server for token.
c.authentication server grants access to webpage(client).
c. Authentication server validates client and give back the generated token.
d. client sends the token to Resource server to access user data
--> Used in LAN , within the industries
3) client Credentials.
App accessing another app
a. App registered itself witht the Authentication server with client ID and secret.
b. Gets the token from authentication .
c. Access Resouce server by providing the Token.
-->Used in SOS microservice apps
4) Refresh token
-->Token will have life span time.
--> Gets generate another token once previous token expires instaead of asking user to login again.
--> It generate fresh token by providing expired token to the authentication server.
Programming paradigms :
1)Imperative Programming paradigm
2)Declarative Programming paradigm
1)Imperative Programming paradigm
a) Procedural Programming paradigm
b) Object Oriented Programming paradigm
c) Parrrel processing Approach
2)Declarative Programming paradigm
a) Loigc Programming paradigm
b) Functional Programming paradigm
c) Database processing Approach
==================================
spring bean life cycle :
initailization callbaks
beanname aware interface
disposable beans
Initializaton callbacks : 3 ways
1. @PostConstruct
2. implement InitializatonBean --> public void afterPropertySet()
3. define your owner method and declare in xml file --> <bean id="" class="" init-method="method_name">
Disposable call backs :
1. @PreDestroy()
2.Impement DisposableBean --> public void destroy()
3.define your own method and declare in xml file --> <bean id="" class="" destroy-method="method_name">
AWARE intefaces :
1. BeanNameAware --setBeanName(Stirng name)
2. BeanFactoryAware --setBeanFactory(BeanFactoryAware)
3. ApplicationContextAware --setApplicationContext(ApplicationContext)
BeanPostProcess
BeanPostProcessor interface --> postProcessBeforeInitialization()
postProcessAfterInitialization()
Spring containers
1.BeanFactory
2.ApplicationContext
1. BeanFactory -- impmentaions
BearnFactory factory=new XmlBeanFactory(Resource)
Resource --> implementations
--> 1. ClassPathResource(".xml")
2. FileSystemResource(".xml")
Life Cycle of Bean in BeanFactory container:
Container start up time :
1.loads the Bean into the memory
2.uses constructor injection to creat the bean
a. bean dependencies
1.xml based explicti wiring
2.xml based auto wiring ---using autowire="byType/byName/constructor"
3.calls setBeanName() method if bean implements BeanNameAware interface
4.calls setBeanFactory() method if bean implement BeanFactoryAware interface
5.call afterPropertySet() if bean implements InitializatonBean
6.calls a method defined in xml with init-method="" attribute of the bean
Container shutdown time :
1. destroy() ---if bean implements DisposableBean
2. calls mehtod defined in xml with destroy-method ="" attribute of the bean.
2.ApplicationContext --> implementions
ClassPathXmlApplicationContext
FileSystemXmlApplicatinContext
XmlWebApplicationContext
Life cycle of Bean in ApplicatinContext container:
1. loads the beans into the memory
2. create bean references by invoking constructors of the bea.
Bean dependencis :
a. Annotaiotn based autowiring.
b.xml based explicit wiring
3.xml based autowiring --autowire attribute
3. Bean Aware:
a.setBeanName() --> if implements BeanNameAware interface
b.setBeanFactory() --> if implements BeanFactoryAware interface
c.setApplicationContext() --> if implements ApplicationContextAware interface
4. BeanPostProcessor
a. invokes postProcessBeforeInitialization() --if bean implements BeanPostProcessor
5. Initializaton call backs
1. @PostConstruct
2. afterPropertySet() --> InitializatonBean
3. method defined in --> init-mehtod attribute in xml
6. 4. BeanPostProcessor
a. invokes postProcessAfterInitialization() --if bean implements BeanPostProcessor
7. Disposable call backs
a.@PreDestroy()
b.destroy() ---> DisposableBean interface
3. method defined in xml --> destroy-method=""
Java 8
Optional class
Optional.of()
--> get() --> NoSuchElementExcetion
--> isPresent()
-->isEmpty()
-->ifPresent()
-->orElse() --default value
--->orElseGet() -- default value --takes supplier as paratemer
--->orElseThrow
Comments
Post a Comment