Jeg Bagus
Jeg Bagus

Reputation: 5075

How to create security anotation like spring security

i wonder how to create security annotation like spring security does (@PreAuthorized or @Secured) that will check session than do something to decide how application will threat the authority to log on user.

is any resource i can read or any recommendation?

best regards

ps: for some reason, i cannot use spring security

Upvotes: 1

Views: 250

Answers (2)

axtavt
axtavt

Reputation: 242686

The technique behind these annotations is called Aspect Oriented Programming (AOP).

Spring Security relies on Spring AOP, which allows you to intercept particular method calls on Spring-managed object, so that you can apply security checks to them.

See Aspect Oriented Programming with Spring. Alternatively, if you want to do it without Spring, see standalone AOP implementations such as AspectJ.

Upvotes: 2

bmargulies
bmargulies

Reputation: 100013

The best tutorial for 'how does Spring Security work' is 'the source of Spring Security'. It is open source. You can read it. Honestly, the question as posed is much to broad to allow for much more of an answer.

Upvotes: 0

Related Questions