2009年10月29日木曜日

Grails+Acegi プログラム上でログイン・ログアウトさせる

Grailsのバージョンは1.2-M3
Acegi Security は 0.5.2

忘れないうちにメモ

import org.springframework.security.providers.UsernamePasswordAuthenticationToken as AuthToken
import org.springframework.security.context.SecurityContextHolder as SCH

class NantokaService {
def daoAuthenticationProvider

// ログイン処理
void systemLogin(String username, String password) {
def auth = new AuthToken(username, password)
def authtoken = daoAuthenticationProvider.authenticate(auth)
SCH.context.authentication = authtoken
}
// ログアウト処理
void systemLogout() {
SCH.context.authentication = null
}
}

こんな感じ

1 件のコメント:

  1. It is the most common and extensively used 3D printing Foot Spas expertise, with larger precision and decrease price. Blender is a 100 percent free 3D design software and it’s the most used software for 3D printing phrases of|in relation to} creating natural shapes. Otherwise, it isn't the most sensible software for designing exact and technical objects for which there are better-suited packages, like Fusion 360.

    返信削除